Clear POST variables
| From: | Mike Tuller | Date: | Thu, 16 Feb 2006 15:07:29 +0000 |
| Subject: | Clear POST variables | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-230544@lists.php.net to get a copy of this message | ||
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.