sandycool9999
New member
I have two documents and I want to validate the drop down menu so that there is one option selected and if they didn't select an option, then an error message appears beside the drop down menu.
Document 1"crazy.php":
<?php
$school=$_GET["school"];
if (isset($school))
$error="*";
else
$error="";
?>
<form name="Stumarks" action="cool.php" method="get">
School: <select name="school" select value="<?php echo $school; ?>"/><font color="red"><?php echo $error; ?></font></p>
<option value="blank" >---Select a school---</option>
<option value="MT">Monteboro Turnwood</option>
<option value="LDH">Longlake Dockwood Highschool</option>
<option value="MHS">Montey High School</option>
</select>
<input type=submit />
</form>
Document 2"cool.php":
<?php
$school=$_GET["school"];
if ($school="blank")
{
header ("Location: crazy.php?school=$school");
}
if ($school ="MT")
echo "You have chosen Monteboro turnwood;"
?>
Document 1"crazy.php":
<?php
$school=$_GET["school"];
if (isset($school))
$error="*";
else
$error="";
?>
<form name="Stumarks" action="cool.php" method="get">
School: <select name="school" select value="<?php echo $school; ?>"/><font color="red"><?php echo $error; ?></font></p>
<option value="blank" >---Select a school---</option>
<option value="MT">Monteboro Turnwood</option>
<option value="LDH">Longlake Dockwood Highschool</option>
<option value="MHS">Montey High School</option>
</select>
<input type=submit />
</form>
Document 2"cool.php":
<?php
$school=$_GET["school"];
if ($school="blank")
{
header ("Location: crazy.php?school=$school");
}
if ($school ="MT")
echo "You have chosen Monteboro turnwood;"
?>