Reputation: 442
I have a PHP shift scheduling app where the flow is: Welcome page > List of schedules page > Actual schedule page
On the Actual schedule page users can do things (like add a shift, remove a shift, request off a shift) that all post back to the same Actual schedule page. What I want is when they click on the various "things", the "things" are not added to the browser history. So, if they click the browser's back button, they just go to the List of schedules page.
The issue I'm running into is you can add shift A, then add shift B, then click back and you're trying to add shift A again.
How is this typically avoided? What can I do?
Upvotes: 0
Views: 1300
Reputation: 4783
Post/Redirect/Get:
http://en.wikipedia.org/wiki/Post/Redirect/Get
Another (old style) option is:
$_POST
the data to a file the users do not go to, such as post_processing.php.
In that script, handle the processing of their requests, make changes as necessary, then header redirect back to the schedules page.
Obviously correctly handle anyone trying to access that file directly etc.
Upvotes: 1
Reputation: 23346
Just return a 302
redirect from the POST handler to the page instead of rendering it.
Upvotes: 2