I have a simple html form that looks like the following
<form action="search.php" method="get">
<p>Company Name:
<input type="text" name="name" />
</p>
<p>
<input type="submit" value = "Search"/>
</p>
</form>
Simple enough, however the problem is I am redirected to search.php (which resides in the same directory as this form page). I would like to be able to display the search results on the same page, (below the form) without redirecting to search.php. What do you suggest?
You could set the form to redirect on the same page
And then check in this php page if the form has been filled or not
And then display the result after the form in the page!
This method inply that the page will be reloaded, if you don’t want it to happen you’ll have to use Ajax to submit the form and get the search result from the Ajax request!