i need a help in implementing a php, javascript stop watch for 4 pages
the total time for stopwatch is 30 minutes when it starts on the next page it should start from the time remaining from previous page and so forth even if it returns to the previous page it should carry on from the time elapsed . At the moment my stopwatch is not linked to other pages it get started from 0 not from the previous page time please help thanks in advance
<?php
session_start();
{
$dateFormat = "d F Y -- g:i a";
$targetDate = time() + (2*120);
$actualDate = time();
$secondsDiff = $targetDate - $actualDate;
$remainingDay = floor($secondsDiff/60/60/24);
$remainingHour = floor(($secondsDiff-($remainingDay*60*60*24))/60/60);
$remainingMinutes = floor(($secondsDiff-($remainingDay*60*60*24)-($remainingHour*60*60))/60);
$remainingSeconds = floor(($secondsDiff-($remainingDay*60*60*24)-($remainingHour*60*60))-($remainingMinutes*60));
$actualDateDisplay = date($dateFormat,$actualDate);
$targetDateDisplay = date($dateFormat,$targetDate);
}
//include "11.php";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Quiz System</title>
<script type="text/javascript">
var days = <?php echo $remainingDay; ?>
var hours = <?php echo $remainingHour; ?>
var minutes = <?php echo $remainingMinutes; ?>
var seconds = <?php echo $remainingSeconds; ?>
function setCountDown ()
{
seconds--;
if (seconds < 0){
minutes--;
seconds = 59
}
if (minutes < 0){
hours--;
minutes = 59
}
if (hours < 0){
days--;
hours = 23
}
document.getElementById("remain").innerHTML = days+" days, "+hours+" hours, "+minutes+" minutes, "+seconds+" seconds";
SD=window.setTimeout( "setCountDown()", 1000 );
if (minutes == '00' && seconds == '00') { seconds = "00"; window.clearTimeout(SD);
//window.alert("Time is up. Test Is Finished.");
window.location = "www.devnetwork.net"
}
}
</script>
</head>
<body onload="setCountDown();">
Start Time: <?php echo $actualDateDisplay; ?><br />
End Time:<?php echo $targetDateDisplay; ?><br />
<div id="remain"><?php echo "$remainingDay days, $remainingHour hours, $remainingMinutes minutes, $remainingSeconds seconds";?></div>
<?php echo '<a href=11.php>Click here</a>';?>
</body>
</html>