Jump to content

[SOLVED] Using PHP with form drop down menu.


sh0wtym3

Recommended Posts

Hey,

 

I am trying to send information to my database using a form. The form below works for the "gender" field, but it does not send the "prefix" field (which is a drop down menu)...?

 

 

The form code:

<td><input type="text" name="gender" id="gender" class="gender" /></td>

<td>
Select your prefix:
<select name="prefix" id="preifx" class="prefix">
<option value="Mrs">Mr</option>
<option value="Mrs">Mrs</option>
<option value="Ms">Ms</option>
<option value="Miss">Miss</option>
<option value="Dr">Dr</option>
<option value="Choose" selected>Please select..</option>
</td>

<td>
<input type="submit" name="btn" id="btn" value="Submit">
</td>

 

The PHP code that is used with this form:

$gender= $_POST['gender'];
$preifx= $_POST['prefix'];
mysql_query("INSERT INTO table
(gender, prefix) VALUES('$gender','$prefix'") 
or die(mysql_error());

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.