Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error - Web Page Has Expired in PHP?

I have six pages for a registration form in my PHP project.

In between any of the page if I press the back button from the explorer bar I get the error:

Webpage has Expired

I am using $_POST to submit the data. I can't understand why this occurs?

like image 231
Nikhil Avatar asked Dec 10 '25 04:12

Nikhil


2 Answers

That message has to do with the way IE handles pages generated from POST data.

In general, to avoid this problem you have to make sure that in the back history, the user will never be able to land on a page that was generated from a POST request. As jspcal suggested, your POST response should be a redirect to another page requested by a GET. This is also considered best-practice since it reduces the risk of submitting a form twice.

like image 140
Daniel Vassallo Avatar answered Dec 12 '25 16:12

Daniel Vassallo


redirect the page after receiving the post:

$name = $_POST['name'];
...
header('Location: next.php');
like image 39
jspcal Avatar answered Dec 12 '25 17:12

jspcal



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!