Re: Clear POST variables

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

 



What I have is a page that you enter the information in, and when you click on submit, it goes to another page that has the code to enter it into the database and says "Thank You, you submitted xxxx information. Are you saying that I should redirect to another page after that?

On Feb 16, 2006, at 9:14 AM, Dan Parry wrote:

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:php@xxxxxxxxxxxxxxxxxxxxxxx]
Sent: 16 February 2006 15:07
To: php list
Subject:  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


[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