Won't work I'm afraid, when a page is refreshed the entire http reqest is resent and reprocessed. You send along a unique key with each request and then check if that key has been processed in the last few hours or something.
eg. (assumes a mysql db)
<?php
//page1.php
//create a key
$key=md5(microtime().'A Unique Key');
?>
<form name="form" method="POST" action="page2.php">
<input type="hidden" name="key" value="<?php echo($key);?>" />
<input type="text" name="var1" />
<input type="submit" name="submit" value="Submit" />
</form>
and then for the page which processes the form
<?php
//page2.php
//db connection stuff
//check the form has been submitted
if(!empty($_POST['submit']) && !empty($_POST['var1']) && !empty($_POST['key'])) {
$sql="SELECT COUNT(*) FROM formcheck WHERE key='$_POST[key]' && time>".(now()-86400)."'";
$res=mysql_query($sql) or die(mysql_error());
$row=mysql_fetch_array($res,MYSQL_NUM);
if($row[0]!=0) {
echo('This is a repost ... fail');
exit();
} else {
//process the form
}
}
Prehapse not very tidily done
:rolleyes: but you get the idea.
HTH
Bubble