Re: Clear POST variables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

You can clear out POST by doing this:
$_POST = array();

But that won't do anything in your case because every time the page is refreshed the form is resubmitted (and POST is repopulated). You need to find a way to ensure unique entries in the database. One option is to store a hidden, random value in the form, like a timestamp or the md5() of a random value. Then store this in the db, along with the other data. Put a unique index on that column so that the same random value cannot be inserted multiple times. (In other words, the form would need to be reloaded, then resubmitted for the data to go into the db.)

HTH,
Larry

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux