Thanks this was the best solution I used this code as part of form validation. // query to check record has not already been added by comparing submitted title with title of last record $query_gnewsid_unique = "SELECT MAX(newsid) AS newsid FROM tblnews"; // execute query $result_gnewsid_unique = mysql_query($query_gnewsid_unique); $row_gnewsid_unique = mysql_fetch_array($result_gnewsid_unique); $newsid_unique = $row_gnewsid_unique['newsid']; // query to extract last title from tblnews $query_gtitle_unique = "SELECT title FROM tblnews WHERE newsid = $newsid_unique"; $result_gtitle_unique = mysql_query($query_gtitle_unique); $row_gtitle_unique = mysql_fetch_array($result_gtitle_unique); $title_unique = $row_gtitle_unique['title']; if ($title == $title_unique) { $message_unique = "You have already entered this record."; $unique = TRUE; } Steve -----Original Message----- From: Burhan Khalid [mailto:phplist@xxxxxxxxxxxx] Sent: 17 December 2004 13:07 To: S.D.Price Subject: Re: Refreshing page after form submission S.D.Price wrote: > 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 { > } > ?> > You can try and check if the user's information already exists in the database, then display an appropriate message. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php