mdemetri2 Posted January 6, 2009 Share Posted January 6, 2009 Hi All Thanks in advance for this, I'm a newb so be gentle. I have searched the net for days trying to figure out how to essentially search a databsae from a php page (which I found references to do) but then couldnt work out how to then use the results rather than just return them on a page. So I have a text box and submit button on one page, which I want to use to search particular fields in my database - I have the SQL for this but need to amend it to get the search string from my text box. The results returned need to have a radio box or check box on each result which when select pulls out one specific field from the record and the variable passed on to an other page. Hope all this makes sense, hope some one can help! Quote Link to comment https://forums.phpfreaks.com/topic/139755-search-mysql-database-using-php-page-then-use-results/ Share on other sites More sharing options...
premiso Posted January 6, 2009 Share Posted January 6, 2009 Post code. Quote Link to comment https://forums.phpfreaks.com/topic/139755-search-mysql-database-using-php-page-then-use-results/#findComment-731179 Share on other sites More sharing options...
mdemetri2 Posted January 7, 2009 Author Share Posted January 7, 2009 Ok, very simple code for form with text box and submit button. <form name="form"> <input type="text" name="search" /> <input type="submit" name="Submit" value="Search" /> </form> SQL which needs amending to use the "search" text box. Select Location_id, Postcode, Town from Locations where Location_id like '%B49%' or Postcode like '%B49%' or Town like '%B49%' There would be more fields but this isnt the issue, its replacing my criteria above '%B49' to refer to the content of the search box above. Some code I found to do a search (but it has things in it that I dont need - e.g. connection details as these are called from an other PHP file). http://www.homeandlearn.co.uk/php/php13p2.html Would then need amending to have check boxes in order to select a particular field from a return record (would only every be one needed). Hope this makes sense - helps. Quote Link to comment https://forums.phpfreaks.com/topic/139755-search-mysql-database-using-php-page-then-use-results/#findComment-731476 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.