Re: Clear POST variables
| From: | Kim Christensen | Date: | Thu, 16 Feb 2006 16:41:36 +0000 |
| Subject: | Re: Clear POST variables | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-230561@lists.php.net to get a copy of this message | ||
On 2/16/06, Mike Tuller <php@discovercommunityed.com> wrote:
> How do I clear out the POST variables, or the variables that I have
> set from the POST variables, so that when the page is refreshed it
> will not resubmit. I have tried unset() and have tried to set it to and
> empty value, but it doesn't seem to work.
When needed, I usually loop through the entire $_POST array and
concatenate all the values to one (long?) string - then I take an MD5
hash of this string together with the form name and put in the
$_SESSION array. Now each time one of my scripts with a form action
loads, I include a script in the top which checks the MD5 hash of the
current $_REQUEST array with the one in the $_SESSION array using the
same name, if it exists - unset($_REQUEST) before the form is normally
parsed and action is taken.
(This idea of a script came from one of my co-workers)
--
Kim Christensen
kim.christensen@gmail.com