Reputation: 9679
I am saving personal information in PHP page.when user click submit it saves but user can go back in submit information page through browser back button.Hoe can I expire my previous page??
Upvotes: 2
Views: 2090
Reputation: 8279
To prevent users from resubmitting forms by using the back button, or refreshing the page, you need to follow a design pattern called Post Redirect Get.
Upvotes: 2
Reputation: 157864
Just make user stay on the same page through the whole process. So, no page to get back at all.
They call it /Post/Redirect/Get pattern. Very handy.
Upvotes: -1
Reputation: 8720
You could use:
session_destroy();
Or you could put this at the top of the page. When user hits back it will make a request for a new copy of the page:
<?php
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Sat, 07 June 1982 09:00:00 GMT"); // Past date
?>
Upvotes: 0
Reputation: 382696
You can use a token and set in a hidden filed, once form is submitted, you should read the value of that hidden field and store in a session and on previous page make a check that if session is set, redirect user elsewhere.
Upvotes: 1