How can i do to forbidden reload a page?
For example:
pag1.php
<?PHP
session_start();
if (!(empty($POST['BOk'])))
{
//Insert a data in my db $POST['data1']
....
//If someone reload this page, the data will be insert again!
}
else
{
echo " <form> action='$_SERVER[PHP_SELF]'method='post'>
Enter your name<input type='text' name='data1'>
<input type='Submit' value='OK' name='BInsertar'>
</form>";
}
?>
</body>
</html>
If someone reload the page when he have already click "ok", the data will be insert again and the key will be duplicate, so it will be an error.
I know that i can verify before insert the data, if the data already exists, but, can i do it the other way??
Thanks in advance!
Router