I have an HTML page for a search operation.
Once the user enters the search criteria and clicks the search button, the result of the search should be displayed on the same page.
However, on the search results page, the search field values entered by the user are cleared due to refresh/redirect to the same page.
How do I capture the field values and display them?
The best option I think, would be to merge your search form and results page, and have your form submit to itself like so:
this way you can still access the searched item by using the form submission your search uses, and making the
value=""attribute of the search field the same value; in PHP this would be:If you do still want to have an intermediate page, then use a hidden input field:
if you have users submit a form to be redirected.