sabo86 Posted September 14, 2008 Share Posted September 14, 2008 if($_POST['searchtype']="Accessories") $field='Accessories'; elseif ($_POST['searchtype']="Seatings") $field='Seatings'; elseif ($_POST['searchtype']="Local Office Furniture") $field='Local Office Furniture'; elseif ($_POST['searchtype']="European Office Furniture") $field='European Office Furniture'; elseif ($_POST['searchtype']="School and University Furniture") $field='School and University Furniture'; $query = "select * FROM items where Category = '$field'"; Just wondering why $field is always taking the string 'Accessories'? knowing that searchtype is the drop menu form..?? Link to comment https://forums.phpfreaks.com/topic/124131-if-statement-and-drop-menu/ Share on other sites More sharing options...
kratsg Posted September 14, 2008 Share Posted September 14, 2008 Two things: One: when posting code, put them in between [*code][*/code] tags. Two: fix your conditionals, you're literally setting the $_POST['searchtype'] variables to those values: if($_POST['searchtype']="Accessories") to if($_POST['searchtype']=="Accessories") instead. Link to comment https://forums.phpfreaks.com/topic/124131-if-statement-and-drop-menu/#findComment-640850 Share on other sites More sharing options...
sabo86 Posted September 14, 2008 Author Share Posted September 14, 2008 Thanks a lot Link to comment https://forums.phpfreaks.com/topic/124131-if-statement-and-drop-menu/#findComment-640853 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.