Submit the data to a page that just inserts it into the DB (validating it
first, natch) then do a header(location) to the thank you (or whatever) page

This also fixes 'page expired' warnings

HTH

Dan

-----Original Message-----
From: Mike Tuller [mailto:[EMAIL PROTECTED] 
Sent: 16 February 2006 15:07
To: php list
Subject: [PHP] Clear POST variables

I have a page that submits form information into a database, and all is
good, but someone testing the page pointed out something to me that I
didn't notice. I have a form that sends you to another page that submits
the data into a database. If you refresh the page, the information is
submitted again. Here is what I have.

         $name = $_POST['name'];
         $address = $_POST['address'];
         $city = $_POST['city'];
         $state = $_POST['state'];
         $zipcode = $_POST['zipcode'];
         $phone = $_POST['phone'];
         $notes = $_POST['notes'];

         $query = "insert into Locations
                                 (name, address, city, loc_state,  
main_phone, zipcode, notes)
                                 values
                                 ('$name', '$address', '$city',  
'$state', '$phone', '$zipcode',
'$notes')";

                                 mysql_query($query, $link) or die  
(mysql_error());


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.


Thanks.

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

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

Reply via email to