PHP/HTML dynamic page/search

Scorpy84

New Member
I'm finding it hard to get my head around the logic around this issue I'm having.Currently, I have a search.html page that on submit goes to Results.php. There is then some code that searches the mysql for whatever was inputted into the search page.Now, How would I go about having the search and the results on the same page? How would i return the variable from the search page? For example before I was using;\[code\]$search_term = $_POST['name'];\[/code\]How would I get the 'name' variable if its on the same page?EDIT: Second issueI have the code working that many of you answered with, thank you very much! I've now come to my second problem. I have two inputs a textbox for the search query and then a dropdown box for a subject to search.Then user then presses submit and the db is searched, this all works fine. I now want to create another dropdown box so the user can sort the provided results in a matter that they see fitting, for example price high to low etc.I have the HTML code already done but as you can imagine, the second I press submit its reloading the page and as it doesn't know what the user has previously searched it exits the php and acts as if its a fresh page load.URL: http://helios.hud.ac.uk/u0862025/db/test.phpPlay around with it, press submit to lift all products in the database.
 
Back
Top