[ Usenet FAQs | Search | Web FAQs | Documents | RFC Index ]
Single Page
Top Document: FAQ: Frequently Asked Questions about CGI Programming
Previous Document: 3.18 How can I use Caches to make CGI scripts faster and more Net-friendly?
Next Document: 3.20 How can I stop my CGI script reading and writing files as "nobody"?
-
Search the FAQ Archives
Single Page
Top Document: FAQ: Frequently Asked Questions about CGI Programming
Previous Document: 3.18 How can I use Caches to make CGI scripts faster and more Net-friendly?
Next Document: 3.20 How can I stop my CGI script reading and writing files as "nobody"?
3.19 How can I avoid users hitting "submit" twice?
You can't. You just have to deal with it when they do. You can avoid re-processing a submission by embedding a unique ID in your Form each time it is displayed. When you process the form, you enter the ID in a database. Or, if it's already there, you don't repeat the processing. You probably want to expire your database entries after a little time: an hour should be fine in a typical situation. If you're already using cookies (e.g. a shoppingcart), an alternative is to use the cookie as a unique identifier. This means you also have to handle the situation where a user deliberately "goes round twice" and submits the same form with different contents. If your script may take some time to process, you should also consider running it as a background job, and returning an immediate acknowledgement to the user (see above if your "immediate" response gets delayed until processing is complete in any case).
Top Document: FAQ: Frequently Asked Questions about CGI Programming
Previous Document: 3.18 How can I use Caches to make CGI scripts faster and more Net-friendly?
Next Document: 3.20 How can I stop my CGI script reading and writing files as "nobody"?
Single Page
[ Usenet FAQs | Search | Web FAQs | Documents | RFC Index ]
Send corrections/additions to the FAQ Maintainer:
Nick Kew <nick@webthing.com>
Last Update December 05 2008 @ 00:13 AM