$test = $info['date'] . $info['time'];
$date = date("Y-m-d H:i:s", strtotime($test));
if (isset($_SESSION['id']) && $_SESSION['id'] == $_GET['id'])
{
if (isset($_GET['BookID']) && is_numeric($_GET['BookID']))
{
if ($date >= (time() + 86400)) {
// current time is 86400 (seconds in 24 hours) or less than stored time
$sql = "DELETE FROM `tbl_booking` WHERE `BookID`={$BookID}";
$result = mysqli_query($con, $sql);
//header("refresh:5;url=dashboard.php");
echo "Your booking has been cancelled.";
}
}
} else {
// if id isn't set, or isn't valid, redirect back to view page
//header("refresh:5;url=dashboard.php");
echo ("Sorry, there is less than 24 hours left and you cannot cancel.");
}
sorry i've looked pretty much everywhere for this and i still can't grasp it.
Basically i'm making a booking system that allows the users to cancel but not if the time they're trying to book is less than 24 hours away.
this at the moment seems to reject every single deletion saying the there is less than 24 hours left even though there isn't.