Okay I’ve spent the last hour trying to find a solution to this but no luck, so I’ll ask you guys to see if you can help!
As simple as this seems how can I submit the value of a select box to an external php page!
I’m sure this code should work, but it isn’t submitting the value at all.
test.php
<form action="test2.php"
method="post"
enctype="multipart/form-data">
<p>
What is your Gender?
<select name="formGender">
<option value="">Select...</option>
<option value="M">Male</option>
<option value="F">Female</option>
</select>
</p>
<input type="submit"
name="submit"
value="Submit" />
</form>
test2.php
<?php
if(isset($_POST['formSubmit']) )
{
$varGender = mysql_real_escape_string($_POST['formGender']);
echo $varGender;
}
else{
echo "Something went wrong";
}
?>
Yet I always end up getting the “Something went wrong” meaning the data isn’t submitting. Any help anyone?
$_POST['formSubmit']is never going to be set because you don’t have a field with a name of ‘formSubmit’. How aboutif(isset($_POST['formGender']))?