After my insert I set the $_POST variable equal to array();, but I still can hit refresh and have a duplicate entry. What direction should I take to prevent double entries?
Thank you.
$postdate = $_POST['thedate'];
$dmy = date('Y-m-d', strtotime($postdate));
$insertQuery = "INSERT INTO tb_entries
SET user_id = '".$_SESSION['user_id']."',
thedate = '".$dmy."',
ftime = '".$_POST['ftime']."',
ltime = '".$_POST['ltime']."',
client_id = '".$_POST['client_id']."',
project_id = '".$_POST['project_id']."',
activity_id = '".$_POST['activity_id']."',
description = '".$_POST['description']."'";
if ($result = $connector->query($insertQuery)){
echo '<center><b>Time Entry Added!</b></center><br>';
}else{
exit('<center>Sorry, there was an error saving to the database</center>');
}
$_POST = array();