There is a very simple solution to this on the page that
does the entries into the database simply to a header redirect
to a new page that displays the success notices etc and if they
do a back or a refresh nothing will happen as the POST data
is on the previous now "removed" from history page.

header('Location: http://www.yourdomain.com/success.html');

* you will need to put some GET data in the URL to show the correct page.

That will do it for you.

Remember that you can't send output on the database entry page simple
to the database calls and they do the header call as above.



Timothy Hitchens (HiTCHO)
[EMAIL PROTECTED]


If you need PHP hosting with an experienced
support team 24/7 then email me today.

On Sun, 29 Dec 2002, Pag wrote:

>
>       Hi,
>
>       I am having some problems with duplicate form input.
>       I have a form that adds comments to an article, works fine, but if the
> user clicks on "refresh", having added a comment previously, the same
> comment is added again. I tried clearing the variables after the database
> write, but the refresh somehow resends the previous values.
>       Roughly, heres how my script works: (not using actual code syntax here)
>
>       ------------------
>       if {$flag=1 AND $name!='' AND $commentbody!=''){
>
>       inserts the comment into the database
>       $flag = 0
>       $name = ''
>       $comment = ''
>       }
>       ------------------
>       routine to display the article and the existing comments here
>       ------------------
>       form here
>       if user clicks send, puts $flag=1 and calls same page
>       ------------------
>
>
>       How can i prevent these double entries? Some command to definitely clear
> the variables?
>       Thanks.
>
>       Pag
>
>
>
> --
> 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

Reply via email to