Re: Clear POST variables

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

 



I'm curious to hear what others say, but I tend to build into my
application flow a header("Location: someurl") redirect after a form
submission.  It's just as if you were to include("somefile") the
resulting page, but by using header() you are moving the user away
from the action so that this sort of thing won't happen.  In my
experience it also helps with a user's tendency to use the back
button--which is not "wrong", it can just get in the way of rich
applications.

Cheers,
John


On 2/16/06, Mike Tuller <php@xxxxxxxxxxxxxxxxxxxxxxx> wrote:
> 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