Refreshing page after form submission

From: Date: Fri, 17 Dec 2004 12:05:02 +0000
Subject: Refreshing page after form submission
Groups: php.general 
Request: Send a blank email to php-general+get-204569@lists.php.net to get a copy of this message
Hi, I have a form which when submitted adds a record to a DB. However if the user clicks back it resubmits the same record. I have tried using cache control to no avail : header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header ("Last-Modified:" . gmdate("D, d M Y H:i:s"). " GMT"); header ("Cache-control: no-store, no-cache, must revalidate"); header("Cache-control: post-check=0, pre-check=0, false"); header ("Pragma: no-cache"); session_cache_limiter("nocache"); I also tried testing for the presence of a submit button so if the user enters data submits the form and clicks back the page will refresh. <?php if ($_POST['submit']) { echo "<META HTTP-EQUIV='refresh' CONTENT='0; URL=$PHP_SELF'>"; } else { } ?> The problem is I need to display a confirmation message after the user submits, and with this technique the page always redisplays the (empty) form after submission. Any ideas? Steve

« previous php.general (#204569) next »