After inserting my form into the database i want to stop it inserting it again if i refresh the page.
I cant seem to work it out
here is my code;
<?php
if(isset($_POST['submit'])) {
$first = mysql_real_escape_string($_POST['fname']);
$last = mysql_real_escape_string($_POST['lname']);
$address = mysql_real_escape_string($_POST['address']);
$email = mysql_real_escape_string($_POST['email']);
$pcode = mysql_real_escape_string($_POST['pcode']);
$country = mysql_real_escape_string($_POST['country']);
$comment = mysql_real_escape_string($_POST['comment']);
$conn = mysql_connect("localhost","user","pass");
mysql_select_db("tbobker_hwpi",$conn);
$today = date("j, n, Y");
$sql = "insert into petition values ('','$today','$first','$last','$address','$email','$pcode','$country','$comment');";
$result = mysql_query($sql,$conn);
$sql2 = "select id from petition";
$result2 = mysql_query($sql2,$conn);
$num_rows = mysql_num_rows($result2);
echo "<div height='300px'><h1>Thankyou for signing the petition</h1><br>".$first." ".$last." you have made a positive step forward</div>";
echo "<br><h2>You are person <span style='color: red'>".$num_rows."</span>";
}else { echo '
<html>