I am relatively new to PHP. I am taking a class and working on a form. So please keep that (me being new and learning) in mind if you decide to help. 8-)
Here is the deal. I have a form. I am using a drop down for the states. I have created a variable to echo out after the form has been submitted. The challenge is that the variable does not print. I am not sure how to get this to work. What I think I need if for the 'value' to get assigned to the variable.
I did search for a solution via google but I do not think I am using the appropriate search terms to find what I am looking for. For this form we are not using a database yet.
<select>
<option id="state" name="state" value="AL">Alabama</option>
<option id="state" name="state" value="AK">Alaska</option>
<option id="state" name="state" value="AZ">Arizona</option>
<option id="state" name="state" value="AR">Arkansas</option>
<option id="state" name="state" value="CA">California</option>
<option id="state" name="state" value="CO">Colorado</option>
<option id="state" name="state" value="CT">Connecticut</option>
<option id="state" name="state" value="DE">Delaware</option>
</select>
Now the variable is assigned here:
$state=$_POST['state'];
And then I have the echo here:
echo '<li>State: ' . $state . '</li>';
When it prints out it just prints the State:
Can anyone help me understand why this is not working and how I can resolve it?
Thank you in advance for your help. Please let me know if you need any more info from me.
idofstate. Beyond that, it is theselectfield that is read by the submission handler -- give theselecttag aname.