hitman6003 wrote:You can't prevent them from pressing the back button, but you could set a session var that when the data has been inserted, the var is set to true...then check to see if that var = true before doing the insert...if it is, abort the insert, if it's not, then go ahead with it.
I use the same session thing with a variable
in my contact script, to aviod spam, flooding and 'double posting' by back button or mistake.
Ir works well.
And people have to shut down browser before be able to send me another message.
<?php
function addEntry($name,$email,$comments) {
/* This part will help prevent multiple submissions */
session_start();
if(isset( $_SESSION['add'] ) )
die('You may only submit once per session!<br><br>Thank you');
// Here comes part where message is recorded and stored
// along with name and email, so I can contact them
// save $name, $email, $comments
$_SESSION['add']=1;
?>
<p> </p>
<p><b>Your message was successfully added!</b></p>
<p>Thank you</p>
<?php
exit();
}
?>