Basicly what is happening here is this. I have a dropdown menu and it echos a line based on the item selected from the menu by way of a simple if, else command. My problem is that the $select variable is the name of the dropdown menu. so when I access the file is works but an undefines variable message is displayed along with my result. I have tried to define $select but I can not get it to work, when I define it then the select will not call the command. Here is my script if someone can please take a look and assist me with a fix. The ral script calls from a database but I 've writen a simple if, else that works just the same.
Thanks in advance
Max
<form name="form1" method="post" action="">
<p>
<select name="select" id="select">
<option value="nothing" selected>Select One</option>
<option value="mobile">Montaro</option>
<option value="ford">Mustang</option>
<option value=""></option>
</select>
<option selected></option>
<option value="select one"> </option>
<option></option>
</p>
<p> </p>
<p>
<input type="submit" name="Submit" value="Submit">
</p>
</form>
<p>
<p>
<?php
print "<p>";
$menu = $select;
if ($menu == 'mobile'){
echo "I have a montaro truck";
}else if ($menu == 'ford'){
echo "I own a white ford mustang";
}else{
echo "I do not own a car at all";
}
?>
Nothing is hard when you realy want to learn it.
Max
Thanks in advance
Max
<form name="form1" method="post" action="">
<p>
<select name="select" id="select">
<option value="nothing" selected>Select One</option>
<option value="mobile">Montaro</option>
<option value="ford">Mustang</option>
<option value=""></option>
</select>
<option selected></option>
<option value="select one"> </option>
<option></option>
</p>
<p> </p>
<p>
<input type="submit" name="Submit" value="Submit">
</p>
</form>
<p>
<p>
<?php
print "<p>";
$menu = $select;
if ($menu == 'mobile'){
echo "I have a montaro truck";
}else if ($menu == 'ford'){
echo "I own a white ford mustang";
}else{
echo "I do not own a car at all";
}
?>
Nothing is hard when you realy want to learn it.
Max