My problem is when I hit the back button, I get the 'you have to resubmit the post data' message box.
Can I make it so that if I hit the back button, $_POST won't be resubmitted?
e.g.
page a: fill out form -> submit
page b: back button
(popup): resubmit blah blah blah
page a: $_POST is resubmitted again
Clear $_POST after processed
Moderator: General Moderators
-
d3ad1ysp0rk
- Forum Donator
- Posts: 1661
- Joined: Mon Oct 20, 2003 8:31 pm
- Location: Maine, USA
What you need is an intermediate page to process the data and another to display the results.
form.html includes a form that posts data to
process.php which does data validation and inserts/selects/whatever from a db then does a header("Location: "); call to
done.php which displays information on what was done or what not.
When they get to done.php and hit back, it will bring them to form.html, since they were really never at process.php (since they were redirected before anything was displayed).
form.html includes a form that posts data to
process.php which does data validation and inserts/selects/whatever from a db then does a header("Location: "); call to
done.php which displays information on what was done or what not.
When they get to done.php and hit back, it will bring them to form.html, since they were really never at process.php (since they were redirected before anything was displayed).
That' s a good ideea d3ad1ysp0rk. Also put in your page with the HTML form this code to stop the browser from caching data inputed. You could also try using GET for the second page then you won' t need the third page (done.php) that d3ad1ysp0rk suggested but only if you trust the validation done in the first page.
Code: Select all
header( "Cache-Control: no-cache, must-revalidate" );
header( "Pragma: no-cache" );