The "page" that actually validates the user input and inserts into the
database shouldn't actually be a page that gets sent to the browser -- it
should be a script with no output, which then redirects to a thanks page.

That way there is no chance of the user hitting refresh and double
posting... of course they can still click back and submit again, but you
remove the biggest problem, hitting refresh.

form.php: user fills in and clicks submit
validate.php validates form content
    if good, insert, and redirect with header("Location: thanks.php")
else
    if bad, show the form again


With a bit of work, this can all happen within one php file.


Clicking submit twice, or click back and re-submitting is a little trickier,
but you could always search the database's most recent 2-5 rows, to see if
there is identical data (email address, username, heading, message text,
etc) before inserting... if okay, cool, otherwise, spit out an error.


Justin French


on 17/09/02 11:52 PM, Resarch and Development ([EMAIL PROTECTED]) wrote:

> What is the best way to avoid the "repeated comment/post" syndrome
> caused by the user clicking the submit button one too many times
> because he/she did not wait for the browser to return a confirmation
> page or the script took too long to execute.
> 
> Thanks in advance
> 


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

Reply via email to