fri3ndly Posted June 15, 2007 Share Posted June 15, 2007 Hi there. I know a little about PHP, and was creating this simple dropdown box selection page and run into some trouble.... <form method="get" name="form" action=""> <label> <select name="select" class="formtext"> <option value="Please select a manufacturer">Please select a manufacturer</option> <option value="Clearview">Clearview</option> <option value="Coalbrookdale">Coalbrookdale</option> <option value="Dovre">Divre</option> <option value="Euroheat">Euroheat</option> <option value="Franco Belge">Franco Belge</option> <option value="Hunter">Hunter</option> <option value="Hwam">Hwam</option> <option value="Jotul">Jotul</option> <option value="Stovax">Stovax</option> <option value="Vermont">Vermont</option> <option value="Yeoman">Yeoman</option> </select> </label> <label></label> <label> <input name="Submit" type="submit" class="formsubmit" value="Submit"> </label> </form><div class="sitetext"> <?php // If submitted, check the value of "select". If its not blank value, get the value and put it into $select. $select=$_GET['select']; if ('$select'=="Clearview"){ echo "This is the Clearview page"; } else{ echo "You selected $select"; } ?> If 'Clearview' is selected and then submitted, 'This is the clearview page' is supposed to be displayed, but instead it just shows the answer to $select (Clearview). Any help much appreciated. Thanks Link to comment https://forums.phpfreaks.com/topic/55710-solved-easy-peasy-if-you-know-php/ Share on other sites More sharing options...
Nhoj Posted June 15, 2007 Share Posted June 15, 2007 Change the if ('$select' to if ($select You use single quotes when you do NOT want any variables to be parsed in between the quotes, for example for plan text. Don't put a variable inside the single quotes. Link to comment https://forums.phpfreaks.com/topic/55710-solved-easy-peasy-if-you-know-php/#findComment-275256 Share on other sites More sharing options...
fri3ndly Posted June 15, 2007 Author Share Posted June 15, 2007 Lol thank you, I was hoping it would be something that simple. Cheers! Link to comment https://forums.phpfreaks.com/topic/55710-solved-easy-peasy-if-you-know-php/#findComment-275257 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.