On Fri, 29 Aug 2003 02:06:55 +0100
David Otton <[EMAIL PROTECTED]> wrote:

> On Thu, 28 Aug 2003 18:50:55 -0400, you wrote:
> 
> >> When you POST a form to the server the server replies with a new
> >> page. if you click the Back button in the browser the server wants
> >to> re-POST the form. Short of using GET is there a way to prevent
> >> re-submitting the previous form?
> 
> >One technique is to use a "middle-man" page that processes your POST 
> >data and inserts it into the database or file or whatever. Then you
> >use header() to send the user to another page.
> 
> Here's a quick fragment to illustrate the technique. It requires a
> file called "list.txt" to exist.
> 
> <?
>       if (isset ($item)) {
>               $fp = fopen("list.txt", "a");
>               fputs ($fp, "<tr><td>$item</td></tr>\r\n");
>               header ("Location: $PHP_SELF");
>               exit();
>       }
> ?>
> <table border="1" cellspacing="2">
>       <?
>               readfile("list.txt");
>       ?>
> </table>
> <br><br>
> <form method="post" action="<? echo ($PHP_SELF); ?>">
>       <p>Add Item: <input type="text" name="item"></p>
>       <p><input type="submit" name="Add" value="Add"></p>
> </form>
> 

Thanks David.


-- 
Regards, Andu Novac

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

Reply via email to