Kolusion Posted August 19, 2011 Share Posted August 19, 2011 Sorry I couldn't think of a subject. I've been coding for 11 hours and my mind is fried. This is what I have: index.html <FORM action="search.php" method="post"> <SELECT name="producttype"> <OPTION>1</OPTION> <OPTION>2</OPTION> </SELECT> <INPUT type="submit" value="Submit"> </FORM> What I am trying to do is get PHP to echo a phrase upon selection. I have tried the following, but the code isn't right: search.php <?php if ($producttype = "2") (echo "2 confirmed" ?> <?php if ($producttype($value = "2")) (echo "2 confirmed" ?> Does anyone know how it would be achieved? Quote Link to comment https://forums.phpfreaks.com/topic/245228-i-cant-think-of-one/ Share on other sites More sharing options...
xyph Posted August 19, 2011 Share Posted August 19, 2011 if( $_POST['producttype'] == '2' ) { echo '2 confirmed'; } http://www.php.net/manual/en/language.control-structures.php http://www.php.net/manual/en/language.operators.comparison.php http://php.net/manual/en/tutorial.forms.php Quote Link to comment https://forums.phpfreaks.com/topic/245228-i-cant-think-of-one/#findComment-1259552 Share on other sites More sharing options...
Kolusion Posted August 19, 2011 Author Share Posted August 19, 2011 Thanks for your input dude, but that didn't work. Quote Link to comment https://forums.phpfreaks.com/topic/245228-i-cant-think-of-one/#findComment-1259555 Share on other sites More sharing options...
Kolusion Posted August 19, 2011 Author Share Posted August 19, 2011 Actually it does work, I typoed. OK GOOD NIGHT! Quote Link to comment https://forums.phpfreaks.com/topic/245228-i-cant-think-of-one/#findComment-1259557 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.