Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Posting Form Data

Status
Not open for further replies.

rpack78

Programmer
Oct 1, 2004
35
US
Is there a way to keep a user from re-posting form data if they hit the back button or refresh? What is the best way to deal with this besides disabling the back button? Can I use javascript to clear out all form data from previous pages? Thanks.

Ryan
 
The answer would be to forward them to a new page, server-side, after handling the form submission.

Ask in the forum for whatever server-side scripting your web server supports for how to do this.

Hope this helps,
Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
So they're filling in a form, pressing submit, getting a results page, pressing [Back] and submitting the form again?

I can't think of an easy way of stopping that, you could probably do something with cookies but it would be quite fiddly. You'd also have to deal with the possibility that people might need to come back one day and fill your form in again (or possibly another person using the same PC as the first).

But are you sure that's what people are doing? It seems a bit unlikely to me. If you're getting the same data submitted multiple times it's more likely to be because they're clicking the submit button more than once. You can stop that with javascript using a script like .

-- Chris Hunt
Webmaster & Tragedian
Extra Connections Ltd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top