View Single Post
Old 10-08-2012, 02:46 AM   PM User | #1
CodyJava
New Coder

 
Join Date: Sep 2012
Posts: 25
Thanks: 21
Thanked 0 Times in 0 Posts
CodyJava is an unknown quantity at this point
Need Help with if than statements

Hi I'm trying to echo out some text when the user submits a form. My problem is i can't get an if statement to work for the option tag under the select tag. I played around with the value and name of the options with no luck.

Here is my code, all my other if statements work except this.

if($SelectedOption == $_Post['tube']){ //selct option output
echo "for your interest in Tube Men.<br>";
}else if($selectedOption == $_Post['oldtube']){
echo "for your interest in 70's Tube Men.<br>";
}else if($selectedOption == $_Post['dinosaur']){
echo "for your interest in Tube Dinosaur.<br>";
}else if($selectedOption == $_Post['gorilla']){
echo "for your interest in Tube Gorilla.<br>";
}else if($selectedOption == $_Post['spider']){
echo "for your interest in Tube Spiderman.<br>";
}else{
echo "for your interest in our products.<br>";
}


Here is what im linking them to.

<select name="product">
<option value="tube" name="1">Tube Man</option>
<option value="oldtube" name="2">70's Tube Man</option>
<option value="dinosaur" name="3">Tube Dinosaurs</option>
<option value="gorilla" name="4">Tube Gorilla</option>
<option value="spider" name="5">Tube Spiderman</option>
</select>

Thanks.
CodyJava is offline   Reply With Quote