x_terminat_or_3
asked on
Clear POST data
Hi
How can I clear the POST data after processing them? So that when the users press the REFRESH button, the data isn't resend?
Ramses (x_terminat_or_3)
How can I clear the POST data after processing them? So that when the users press the REFRESH button, the data isn't resend?
Ramses (x_terminat_or_3)
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
To clear post data:
$_POST = array();
but that will not prevent the behaviour you are seeing of the browser trying to resend the data,
You need to point the form to a seperate page (eg. <form action="process.php.... ) then in that file you would have
<?php
//process form data
header("location: destination_page.php");
exit;
?>
where destination_page.php is the page the user will be redirected to once the data has been processed. This will be invisible to the user, it will appear they have been sent straight to the destination page without the middle man page being present and will prevent the browser tring to resend the data on refresh or hitting the back button.
$_POST = array();
but that will not prevent the behaviour you are seeing of the browser trying to resend the data,
You need to point the form to a seperate page (eg. <form action="process.php.... ) then in that file you would have
<?php
//process form data
header("location: destination_page.php");
exit;
?>
where destination_page.php is the page the user will be redirected to once the data has been processed. This will be invisible to the user, it will appear they have been sent straight to the destination page without the middle man page being present and will prevent the browser tring to resend the data on refresh or hitting the back button.
ASKER
Yeah but that means that the destination page has to be static
I already saw sites implementing a way that clears POST data but keeps them somehow in memory
I already saw sites implementing a way that clears POST data but keeps them somehow in memory
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I think I like this better ;)
:)
If you have any problems with it feel free to post back.
If you have any problems with it feel free to post back.
ASKER