RobertFullmen Posted June 1, 2011 Share Posted June 1, 2011 Hey All. I'm trying to modify a search I have setup. What I want to do is take out the text field and replace it with a dropdown menu. It starts with an html form Old working code: <form action="result.php" method="post"> <div align="center">Search: <input type="text" name="search" /> <input type="submit" /> </div> </form> New non working code: <form action="result.php" method="POST"> <select name="dropdown"> <option value="option1">option1</option> <option value="option2">option2</option> <option value="option3">option3</option> </select><input type="submit" name="search" /> </form> That should open up result.php which searches two fields in a mysql database and prints of the results. result.php $var = $_POST["search"]; $data = mysql_query("select * FROM database1 WHERE field1 LIKE '$var' || field2 LIKE '$var'") or die(mysql_error()); echo $data; ?> If result.php not receiving the info in the dropdown or am I handling it wrong in the php? Thanks so much. Quote Link to comment https://forums.phpfreaks.com/topic/238065-dropdown-search/ Share on other sites More sharing options...
xyph Posted June 1, 2011 Share Posted June 1, 2011 $var = $_POST["search"]; <input type="text" name="search" /> <select name="dropdown"> Quote Link to comment https://forums.phpfreaks.com/topic/238065-dropdown-search/#findComment-1223361 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.