Page 1 of 1

how to unset a post variable

Posted: Tue Jan 20, 2009 12:10 pm
by kushaljutta
i want to destroy a $_POST['some variable'] in my code..

i used unset(); function for that but it is not working....

my problems is

first of all i sent a variable(some x in sample.php) to next page(xyz.php) in that page i need that variable($x) for inserting a data..after inserting i press F5 it is again inserted into the database..

so i want to unset that variable($x) in xyz.php page....

can anybody help me in that case..

and also i need to block page refreshing script

Re: how to unset a post variable

Posted: Tue Jan 20, 2009 12:30 pm
by Burrito
every time you refresh the page, the $_POST array will repopulate. The best solution to your issue is to redirect back to the page using header() or some other redirection method so the $_POST array gets dumped.

look how phpBB does it when you post a message. It takes you to a page (where data is posted) then redirects you back to the thread....