how can i send a value from a drop-down menu toe the DB table?
Code: Select all
<html>
<body>
<?php
if (isset($_POST['submit'])) {
// process form
$db = mysql_connect("localhost", "root");
mysql_select_db("library",$db);
$sql = "INSERT INTO book (call_no,title,author1,author2,publisher,isbn,price,no_of_page,edition,category) VALUES ('{$_POST['T1']}','{$_POST['title']}','{$_POST['author1']}','{$_POST['author2']}','{$_POST['publisher']}','{$_POST['isbn']}','{$_POST['price']}','{$_POST['no_of_page']}','{$_POST['edition']}','{$_POST['pull']}',)";
$result = mysql_query($sql);
echo "Your data was inserted successfuly\n";
} else{
// display form
?>
<table border="0" width="35%">
<tr>
<td width="100%"><img border="0" src="file:///f:/web/ibcslarge.png" width="317" height="30"></td>
</tr>
<tr>
<td width="100%"> </td>
</tr>
</table>
<table border="0" width="35%">
<tr>
<td width="100%"> </td>
</tr>
<tr>
<td width="100%"></td>
</tr>
</table>
<table border="0" width="100%">
<tr>
<td width="100%"><a href="http://">Home </a> <a href="http://">Account </a>
<a href="file:///F:/my%20project%20work%20(final)/CD_ENTRY_FORM.htm">New
CD Entry Form </a> <a href="http://">New Journal Entry
Form </a> <a href="http://">Delete Record</a></td>
</tr>
</table>
<table border="0" width="35%">
<tr>
<td width="100%"> </td>
</tr>
</table>
<table border="0" width="35%" bgcolor="#FFCC66">
<tr>
<td width="100%">
<p align="center"><font size="3">NEW BOOK ENTRY FORM</font></td>
</tr>
</table>
<table border="0" width="35%">
<tr>
<td width="100%"> </td>
</tr>
</table>
<form method="post" action="<?php echo $PHP_SELF?>">
<table border="0" width="100%">
<tr>
<td width="15%">Call No</td>
<td width="85%"><input type="text" name="T1" size="20"></td>
</tr>
<tr>
<td width="15%">Book Title</td>
<td width="85%"><input type="text" name="title" size="20"></td>
</tr>
<tr>
<td width="15%">Author1</td>
<td width="85%"><input type="text" name="author1" size="20"></td>
</tr>
<tr>
<td width="15%">Author2</td>
<td width="85%"><input type="text" name="author2" size="20"></td>
</tr>
<tr>
<td width="15%">Publisher</td>
<td width="85%"><input type="text" name="publisher" size="20"></td>
</tr>
<tr>
<td width="15%">ISBN</td>
<td width="85%"><input type="text" name="isbn" size="20"></td>
</tr>
<tr>
<td width="15%">Price</td>
<td width="85%"><input type="text" name="price" size="20"></td>
</tr>
<tr>
<td width="15%">No of Page</td>
<td width="85%"><input type="text" name="no_of_page" size="20"></td>
</tr>
<tr>
<td width="15%">Category</td>
<td width="85%"><select size="1" name="pull">
<option selected>Choose a Category</option>
<option>Programming</option>
<option>Databases</option>
<option>Networking</option>
<option>Operating Systems</option>
<option>Algorithm</option>
</select></td>
</tr>
</table>
<p>
<input type="submit" value="Submit" name="submit">
<input type="reset" value="Reset" name="reset">
</p>
</form>
<?php
} // end if
?>
</body>
</html>