I have a exam form. But I want to show that form within given date and time. Means if start date time is 2016-06-24 11:34:04 and end date time is 2016-06-27 00:00:00 If any merson open form between given date and time the form should be open otherwise it will go on another message page. I have a code .But it is not working. Please help.
<?php
include("connection.php");
date_default_timezone_set('Asia/Kolkata');
$timestamp = time();
$date_time = date("Y-m-d H:i:s", $timestamp);
$result=mysql_query("select * from activeform");
while($row=mysql_fetch_array($result))
{
extract($row);
if($date_time > '$startdate' and $date_time < '$enddate')
{
header("Location: myaccount.php");
}
else{
echo"date has been exceeds";
}
}
?>