Hello.
I am having a bit of trouble with being able to submit/record the data from a selected dropdown field to my DB.
Here is what I know so far:
- Connection to DB is fine; All other data fields are submitted and recorded to DB
- The dropdown (To select country of origin) works fine on the front-end
- Upon submission all other fields EXCEPT the dropdown field is dumped into the DB correctly.
I am missing something fundamental here.
Here is a snippet (Full code upon request)
function NewUser()
{
$userName = $_POST['user'];
$email = $_POST['email'];
$password = $_POST['pass'];
$country = $_POST['country'];
$query = "INSERT INTO WebsiteUsers (user,email,pass,country) VALUES ('$userName','$email','$password', '$country')";
$data = mysql_query ($query)or die(mysql_error());
if($data)
{
echo "YOUR REGISTRATION IS COMPLETED...";
}
...
<label class="grey" for="dropdown">Country:</label>
<name="country" id="country" size="23" />
<select name="countries" id="countries" style="width:290px;">
<option value='us' data-image="images/msdropdown/icons/blank.gif" data-imagecss="flag us" data-title="United States" selected="selected">United States</option>
<option value='ad' data-image="images/msdropdown/icons/blank.gif" data-imagecss="flag ad" data-title="Andorra">Andorra</option>
I think it has something to do with this:
<label class="grey" for="dropdown">Country:</label>
<name="country" id="country" size="23" />
I am a bit confused as to what I'm doing wrong - Probably something obvious that I'm missing.
Thank you in advance for any help!
Matthew