harkly Posted November 9, 2008 Share Posted November 9, 2008 I want to use a somewhat advanced search form but I can't find anything online to help me figure out how to pull the values and pass the variable. If someone selects "Movements" I want a query done on that database but I can't figure out how to pass that value to search.php <form name="search" method="post" action="search.php"> Seach <select NAME="field"> <option value="all">All</option> <option value="artist">Artists</option> <option value="artwork">Art Works</option> <option value="medium">Mediums</option> <option value="movement">Movements</option> <option value="genre">Genres</option> <option value="museum">Museums</option> <option value="period">Periods</option> </Select> for <input type="text" name="find" /> <input type="hidden" name="search" value="yes" /> <input type="submit" name="search" value="search" /> </form> Link to comment https://forums.phpfreaks.com/topic/131987-advanced-search-form/ Share on other sites More sharing options...
MasterACE14 Posted November 9, 2008 Share Posted November 9, 2008 you already are with the form. use on search.php... <?php echo $_POST['field']; echo "<br />"; echo $_POST['find']; ?> Link to comment https://forums.phpfreaks.com/topic/131987-advanced-search-form/#findComment-685822 Share on other sites More sharing options...
ratcateme Posted November 9, 2008 Share Posted November 9, 2008 is movements a database or table? for a table //some code to connect to DB $table = mysql_real_escape_string($_POST['field']); $search = mysql_real_escape_string($_POST['find']); $query = "SELECT * FROM `{$table}` WHERE `search_field` LIKE (\"%{$search}%\")"; //some code to do the query and display the results Scott. Link to comment https://forums.phpfreaks.com/topic/131987-advanced-search-form/#findComment-685823 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.