Re: Forms and destroying values

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

 



Beauford wrote:
> Thanks, a little confusing there. You would think though that once the info
> is transmitted by the browser it would be forgotten by the browser. Anyway,
> I do have a work around, and since PHP can't do anything about what the
> browser does, this will have to suffice.

But a refresh button is basically a "retry the last operation" so it's
not surprising the same information is sent again.

The correct solution here is to use the technique mentioned by Satyam.

Bascially:

<form action="handler.php" method="post">
blah
</form>

handler.php
<?php

if (!empty($_POST))
{
  // Do stuff with $_POST, store it in a DB whatever.
  header('Location: hander.php')
  exit;
}

// Normal page output not referring in any way to $_POST
echo "Normal Page".
// If you have to present the data previously given in $_POST, then
// either store it in a DB or in a Session when handling the data above,
// then access the data from the DB or Session here.

// EOF
?>


This technique also means that the "back button" in the users browser is
not "broken" by posting forms... which is nice.

Col

-- 
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