ljaii Posted June 19, 2007 Share Posted June 19, 2007 Hey, I have currently made a simple PHP search script which, when data is entered in a text box and it's submitted, it queries a table in a MYSQL database and returns information. This works. However, I want to have a combo box beside the text box with options to query different tables depending on which item in the combo is selected. At the moment it searches a news articles table by content and title. But I want to adapt the script so that it searches another table which holds information on people for example. It currently gets the item from the text box with the code: $v = @$_GET['entered'] ; $entereddata = trim($v); Then queries the database with: $query = "select * from news where content like \"%$entereddata%\" or title like \"%$entereddata%\" order by date"; Is this possible to return results from different tables depending on the selection made in a combo box? Thanks, LJ Quote Link to comment https://forums.phpfreaks.com/topic/56188-search-drop-down-menu-to-choose-mysql-table/ Share on other sites More sharing options...
MasterACE14 Posted June 19, 2007 Share Posted June 19, 2007 I'm pretty sure its possible I just don't know how to do it. ??? UPDATED: on second thoughts this might work. <form> <input type="radio" name="table" value="<?=$table1?>"> Table 1 <br> <input type="radio" name="table" value="<?=$table2?>"> Table 2 </form> Regards ACE Quote Link to comment https://forums.phpfreaks.com/topic/56188-search-drop-down-menu-to-choose-mysql-table/#findComment-277532 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.