Re: Browser reload problem

From: Date: Thu, 29 Jul 2004 16:16:51 +0000
Subject: Re: Browser reload problem
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-192201@lists.php.net to get a copy of this message
> > 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. > > -- > W | I haven't lost my mind; it's backed up on tape somewhere. > +-------------------------------------------------------------------- > Ashley M. Kirchner <mailto:ashley@pcraft.com> . > 303.442.6410 x130 What I usually do is send a header redirect back to the same page. Your DB injection should occur before any HTML output. At the end of the DB injection simply add: header("Location:your_php_page.php"); exit; This will reload that page and all the $_POST data will be removed. THen you can hit refresh all you want. -- --Matthew Sims --<http://killermookie.org>

« previous php.general (#192201) next »