PHP – Avoid reloading page after form submit
User2108393’s Questions:
I’m new to php and web-programming… I’m working on a school project modifying databases through a corporate site.
I’m using some forms to allow the user to look for information that will be used to fill up other forms on the same page. In this case, a car rental, I look for available cars, show them on a table and then the user picks a car and its info would fill up some other inputs on the same page.
I’m able to do the search and show the result, but then when the user picks the car and clicks submit the whole page is uploaded again. Please, any suggestions?
J.
Redirect to a different page/route, other than the one page was submitted to.
An example for different page redirection.
header("location: differentpage.php");
exit;
Once you are in differentpage.php
you cannot reload the POST request. TO get the data you can use SESSION
or GET
parameter as per requirements.