CGI form repost from browser--how to prevent?

Scherer, Bill Bill.Scherer at VerizonWireless.com
Tue Dec 11 14:04:55 EST 2001


Chris - 

Try tracking the state in J(ava)Script on the client side.  When 
the user performs an action leading to a form submission, set 
the flag just prior to the submit() call.  Check the flag before 
that. If it's in a submitted state, ignore the user request, or 
inform them that a submit is in progress or whatever...


On 11 Dec 2001, Chris wrote:

> I'm writing a Python cgi script that does some inserts into a mysql
> database based on data in an html form submitted by a user.  Is there
> any way to prevent the browser from reposting the data from the form
> when the user hits refresh in the browser after they have submitted
> the form?  When this happens, the script receives the same cgi form
> data and performs the same inserts on the database.  I think maybe
> this can be prevented by storing some state info with cookies??  Not
> sure (have never used cookies).  Any ideas on an easy way to prevent
> this?
> 
> Many Thanks.
> 
> -Chris
> 

-- 
Bill.Scherer at Verizon Wireless
RHCE 807101044903581





More information about the Python-list mailing list