I use logic like this to avoid this problem: Submit data from form to a separate PHP script that handles the database submission then forwards to a results page which queries the database for the information from an ID passed along with the page forward. If you do this, when you refresh the results page, the only thing that gets performed is the SELECT since the INSERT/UPDATE logic is in a separate script. There may be other ways, but that's what I do. Hope this helps. Rich > -----Original Message----- > From: mike karthauser [mailto:mikek@brightstorm.co.uk] > Sent: Thursday, January 09, 2003 12:24 PM > To: php-db@lists.php.net > Subject: preventing page from resubmitting when > refreshing page > > > I have a page that has a form on the first part that posts to > itself and > dumps the contents of the form into a database. > > All this is well and good - I'm using > > if ($_POST['submit']) { > > > } > > to detect the submission and everything is doing as it should. > > Thing is if you refresh the page that displays the results it > then posts to > the database again. I've tried some error trapping but in the > same way the > page hold the post variables it just redoes what it has done > rather than re > running the script. > > Is there something i can do on browser refresh to prevent > this or prevent my > mysql database from duplicating the records? > > any help would be appreciated. > > cheers > mikek > -- > Mike Karthauser > Managing Director - Brightstorm Ltd > > Email >> mikek@brightstorm.co.uk > Web >> http://www.brightstorm.co.uk > Tel >> 0117 9426653 (office) > 07939 252144 (mobile) > > Snailmail >> Unit 8, 14 King Square, > Bristol BS2 8JJ > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php