I am trying to send an HTML <form> and have input and select information entered into a MySQL database table. My code enters data <input type="text"> into the table, but does not enter data into <select> .
This is the <form> that I used:
<form enctype="multipart/form-data" action="send.php" method="post"> <select name="gender"> <option value="Male"> Male</option> <option value="Female">Female</option> </select> <input type="text" name="name"> <input type="submit" value="Add"> </form>
And this is the PHP that I used to enter the form into the table:
<?php $gender=$_POST['gender']; // This is the select/dropdown $name=$_POST['name']; // This is the text input mysql_connect("", "", "") or die(mysql_error()) ; mysql_select_db("") or die(mysql_error()) ; mysql_query("INSERT INTO `table1` VALUES ('$gender', '$name')") ; ?>
source share