Clear POST variables on page refresh

From: Date: Thu, 03 Feb 2005 17:57:22 +0000
Subject: Clear POST variables on page refresh
Groups: php.general 
Request: Send a blank email to php-general+get-208015@lists.php.net to get a copy of this message
I'm not sure if this is specifically a PHP problem, but here we go. Is there a way to clear the POST variables when the user refreshes a page? Specifically, my webpage POSTs a form to update or delete a record from the database -- it POSTs to itself, however. But if the user then clicks the browser's refresh button, it will try to delete or modify a non-existent record. I would like, if the users presses the refresh button, that PHP processes the page as no POST variables are set. I have a button on the page entitled "Reload" that executes a short Javascript: onclick=window.location=<? echo PHP_SELF; ?> which accomplishes the desired effect. But it tries to resend the POST information if the browser refresh button is clicked. I read something somewhere that seemed to imply this could be done with PHP sessions? Is this the way to go? If so, how? Thanks for any help. Richard Morley

« previous php.general (#208015) next »