I have a flow like this
- Order Form page (index.php)
- Confirmation page (where email is entered) (place-order.php)
- Success page (register.php)
All pages have the order form with display:none and can be called on click to display.
In the success page, if the email is empty, it says 'go back and retry'.
Now when I use history.go(-1) or window.location.replace("place-order.php"); or
window.history.back(); it goes to the previous page. But the browser asks the user to reload page as the webpage has expired.
window.location=url will not work as it will go the url and all previously posted form data to that page will be lost
I want the browser to go back to the page and automatically refresh the page without the browser asking you to do it retaining the form values as when passed on from order form
What would be the best approach ?
I realized that the answer is very simple using the _SESSION Variable !
I stored the POST variable to SESSION['place-order'] variable and used
in the register.php page to redirect and added the following code to the place-order.php page