Hi,

* David H wrote:
> After I submited a query, if I use back then forward
> again the form will resubmit itself. Which I do not
> want. Does anyone have a solution for this problem?

Register a token in a session var after submitting the
form. When the user get's again on the resubmitted page
you should test if the token exists in the session. If
it does, you know he has resubmitted the form.

<?php
  if (isset($_POST["submit"])) {
        if (!isset($_SESSION["token"])) {
                $_SESSION["token"] = "submitted";
                /**
                * continue validating, parsing etc.
                * the data
                */
        } else {
                /**
                * error: form was resubmitted
                */
        }
  } else {
        /**
        * display form
        */
        ?>
        <form action="<?php print $PHP_SELF; ?>" method="POST">
        .
        .
        .
        </form>
        <?php
  }
  .
  .
  .
?>

-- 
PHP Magazines for Professionals

PHP Magazin               *                          PHP Magazine
http://www.phpmag.de/     *               http://www.php-mag.net/
German Edition            * International Edition with own topics

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

Reply via email to