Re: Browser reload problem

From: Date: Thu, 29 Jul 2004 07:38:26 +0000
Subject: Re: Browser reload problem
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-192157@lists.php.net to get a copy of this message
Quoting "Ashley M. Kirchner" <ashley@pcraft.com>: > PayPal passes a ton of data back to us when someone's done > purchasing something. I use some of that information and shove it all > into a database. Problem is, if someone hits reload on their browser, I > get the same data re-inserted again. Reload the page four times, and I > will get four records with the same data inserted. How can I avoid > this? I'd like to silently either discard the information after it's > been inserted, or silently prevent it from being re-inserted again. 1. Receive PayPal data in your script. 2. Process it (stick into database). 3. Redirect to another script and forward any data you want displayed. 4. Have the 2nd script show whatever confirmation message you want. The user can now reload all he wants, he gets just the 2nd script which doesn't do anything but display the same message over and over. ATTENTION: if you receive the PayPal data by POST be sure to redirect using "303 See Other", which will "deactivate" the POST and force the redirect to use GET. Of course, forwarding any data to the 2nd script should be done as GET parameters. Or, even better, just forward the 2nd script the database ID of the data you just recorded and if it needs to display anything it can get it from there. -- Romanian Web Developers - http://ROWD.ORG

« previous php.general (#192157) next »