I have created a simple register system that works as intended, although I'd like to give the user an option of selecting a value from a drop down menu as they register, e.g. Male or female. The user will then be distinguishable in the database as a male or female, along with their username and password. I am using a simple php dropdown menu to select the data from.
I would like to know how I could implement this into my register system, to allow the users to select a gender from a dropdown menu when they register and have it inserted into the database along with their username and password. Thanks
HTML -
<form action="" method="POST">
<select name="formGender">
<option value="M">Male</option>
<option value="F">Female</option>
</select>
PHP -
if(isset($_POST["submit"])){
if(!empty($_POST['user']) && !empty($_POST['pass'])) {
$user=$_POST['user'];
$pass=$_POST['pass'];
$con=mysql_connect('localhost','root','') or die(mysql_error());
mysql_select_db('user_registration') or die("cannot select DB");
$query=mysql_query("SELECT * FROM login WHERE username='".$user."'");
$numrows=mysql_num_rows($query);
if($numrows==0)