Simulating POST with GET and Location:

From: Date: Fri, 02 Nov 2001 16:03:20 +0000
Subject: Simulating POST with GET and Location:
Groups: php.general 
Request: Send a blank email to php-general+get-73276@lists.php.net to get a copy of this message
Hi list, Don't you just hate the way that the POST method makes browsers act some times? Expiring pages and asking you if you really want to reload this page. I have found a solution. Instead of relying on the POST method to protect pages from being accessed twice, I use GET and at the end of a processing script using <? header("Location: next_page.html") ?> redirecting the client to the desired url. So when the client tries to go back and forth accessing pages with their browser, the processing page is virtually replaced with the url "next_page.html", thus stopping an additional posts. Hope this is useful. <? /* Processing script */ if($submit){ /* Delete something with the database */ mysql("database", "delete from table where id = $id"); header("Location: next_page.html"); exit; } ?>

« previous php.general (#73276) next »