How do you validate drop down menus?
Posted: Sun Nov 13, 2011 9:03 pm
<form name="Stumarks" action="report.php" method="GET">
School: <select name="school" value="<?php echo $school; ?>" /></input><font color="red"><?php echo $schoolerror; ?></font></p>
<option value="blank" >---Select a school---</option>
<option value="MT">MT</option>
<option value="LDH">LDH</option>
<option value="MHS">MHS</option>
</select>
<input type="Submit">
</form>
How would I validate the drop down menu so that if the user had not selected one of the options than, the they will get redirected to the originial document and an error message would pop up beside the form. I have two documents.
School: <select name="school" value="<?php echo $school; ?>" /></input><font color="red"><?php echo $schoolerror; ?></font></p>
<option value="blank" >---Select a school---</option>
<option value="MT">MT</option>
<option value="LDH">LDH</option>
<option value="MHS">MHS</option>
</select>
<input type="Submit">
</form>
How would I validate the drop down menu so that if the user had not selected one of the options than, the they will get redirected to the originial document and an error message would pop up beside the form. I have two documents.