momukhtar 0 Newbie Poster

I have a Ajax / PHP timer code that would run and update timer on a webpage for 2 hrs. But in IE the time does not refresh and maintain its initial value.

<?php 

function timeDiff($startTime) { 


   $tNow = date("h:i:s"); 
   //echo $tNow."<br/>"; 

   // Extract $current_date h:m:ss 
   $current_hour = substr($tNow,0,2); 
   $current_min = substr($tNow,3,2); 
   $current_seconds = substr($tNow, 6, 2); 

   $start_hour = substr($startTime,0,2); 
   $start_min = substr($startTime,3,2); 
   $start_seconds = substr($startTime, 6, 2); 
    
   $tFinishtime = mktime($start_hour+2, $start_min, $start_seconds); 
   $tCurrenttime = mktime($current_hour, $current_min, $current_seconds); 
    
   $hoursround = floor(($tFinishtime-$tCurrenttime)/3600); 
   $minutesround = floor((($tFinishtime-$tCurrenttime)/60) - (60 * $hoursround) ); 
   $secondsround = ($tFinishtime-$tCurrenttime) - (60 * 60 * $hoursround) - (60 * $minutesround); 
    
   $hoursround = "0".$hoursround; 
    
   if($secondsround < 10) 
      $secondsround = "0".$secondsround; 
   if($minutesround < 10) 
      $minutesround = "0".$minutesround; 
    
   echo  $hoursround. ":". $minutesround. ":".$secondsround; 
} 

timeDiff($_GET['time']); 
?> 

function timer() { 
//debugger; 
   var xmlHttp; 
   try { 

      xmlHttp=new XMLHttpRequest(); 
   } 
   catch (e) { 
      // Internet Explorer 
      try { 
         xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); 
       } 
      catch (e) { 
         try { 
            xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); 
         } 
         catch (e) { 
            alert("Your browser does not support AJAX!"); 
            return false; 
         } 
       } 
   } 
    
   xmlHttp.onreadystatechange=function() { 
      if(xmlHttp.readyState==4) { 
         document.onlinetestform.timer1.value = xmlHttp.responseText; 

       } 
   } 
   xmlHttp.open("GET","time.php?time=06:51:00",true); 
   xmlHttp.send(null); 
   newtime = window.setTimeout("timer();", 1000); 
}