title: Passing a Java Script Millisecond Timer Value to PHP
body: <p>I have used a Java Scipt millisecond timer, I want to pass the timer value to php when user submits the window. Can anyone please help on how to send the JS timer value to PHP ?</p>
  
  <p>My JS Timer Code is as follows :-</p>
  
  <p>I need to pass Seconds.Millisecond value to PHP, when user submits a form.</p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /&gt;
  &lt;title&gt;Untitled Document&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript"&gt;
  
      $(function () {
          $(document).keydown(function (e) {
              return (e.which || e.keyCode) != 116;
          });
      });
  &lt;/script&gt;
  &lt;script src="http://code.jquery.com/jquery-1.9.1.js" type="text/javascript"&gt;&lt;/script&gt;
    &lt;script type="text/javascript"&gt;
      $(function () {
        $(document).bind('contextmenu',function(e){
          e.preventDefault();
          alert('Right Click is not allowed');
        });
         });
  &lt;/script&gt;
  &lt;script&gt;
  var millisec = 0;
  var seconds = 0;
  var timer;
  function display(){
  
    if (millisec&gt;=99){
       millisec=0
       seconds+=1
    }
    else
       millisec+=1
       document.d.d2.value = seconds + "." + millisec;
       timer = setTimeout("display()",8);
       }
  function startstoptimer() {
    if (timer &gt; 0) {
       clearTimeout(timer);
       timer = 0;
    } else {
       display();
    }
  }
  
  &lt;/script&gt;
  &lt;b&gt;Time Elapsed&lt;/b&gt;
  &lt;form name="d"&gt;
  &lt;input type="text" id="time" size="8" name="d2"&gt;
  &lt;/form&gt;
  
          &lt;script&gt;
              function logout() 
              {
                  alert('Times Up, Thank you for taking part in this Quiz!');
                  document.forms['QuizQuestions'].submit();
              }
  
              function StartTimer() 
              {
                  t = setTimeout(logout, 80000)//logs out in 15 mins
  
              }
              function submitThis() {
                  document.forms['QuizQuestions'].submit();
              }
          &lt;/script&gt;
  
          &lt;/script&gt;
  
          &lt;body bgcolor="#cceeff" onLoad="startstoptimer();"&gt;
          Hello &lt;?php session_start();
          echo $_SESSION['signum'];
              $my_t=getdate(date("U"));
              $datestamp = "$my_t[weekday], $my_t[month] $my_t[mday], $my_t[year], $my_t[hours]:$my_t[minutes]:$my_t[seconds]";
              $_SESSION['StartTime'] = $datestamp;
              $_SESSION['timervals']="&lt;script&gt; document.write(c)&lt;/script&gt;";
          ?&gt;, All the best !
          &lt;form name='QuizQuestions' method="post" action="ScoreQuiz.php"&gt;
              &lt;pre&gt;
              &lt;font face='sans-serif' size=2&gt;
  &lt;input type="hidden" name="time1"  id="time"&gt;
  
  Question 1
  In the following PHP Script, what is the correct output:
  $x=array("aaa","ttt","www","ttt","yyy","tttt");
  $y=array_count_values($x);
  echo $y[ttt];
  &lt;input type="hidden" name="qq1" value="null"&gt;
  &lt;input type="radio" name="qq1" value="1"&gt; 2
  &lt;input type="radio" name="qq1" value="2"&gt; 3
  &lt;input type="radio" name="qq1" value="3"&gt; 1
  &lt;input type="radio" name="qq1" value="4"&gt; 4
  
  &lt;hr&gt;Question 2
  In PHP Which method is used to getting browser properties?
  &lt;input type="hidden" name="qq2" value="null"&gt;
  &lt;input type="radio" name="qq2" value="1"&gt; $_SERVER['HTTP_USER_AGENT']
  &lt;input type="radio" name="qq2" value="2"&gt; $_SERVER['PHP_SELF']
  &lt;input type="radio" name="qq2" value="3"&gt; $_SERVER['SERVER_NAME']
  &lt;input type="radio" name="qq2" value="4"&gt; $_SERVER['HTTP_VARIENT']
  
  &lt;hr&gt;Question 3
  In the following PHP Script, what is the correct output:
  $x=dir(".");
  while($y=$x-&gt;read())
  {
  echo $y."
  "
  }
  $y-&gt;close();
  &lt;input type="hidden" name="qq3" value="null"&gt;
  &lt;input type="radio" name="qq3" value="1"&gt; display all folder names
  &lt;input type="radio" name="qq3" value="2"&gt; display a folder content
  &lt;input type="radio" name="qq3" value="3"&gt; display content of the all drives
  &lt;input type="radio" name="qq3" value="4"&gt; Parse error
  
  &lt;hr&gt;Question 4
  In PHP, which of the following function is used to insert content of 
  one php file into another php file before server executes it:
  &lt;input type="hidden" name="qq4" value="null"&gt;
  &lt;input type="radio" name="qq4" value="1"&gt; include[]
  &lt;input type="radio" name="qq4" value="2"&gt; #include()
  &lt;input type="radio" name="qq4" value="3"&gt; include()
  &lt;input type="radio" name="qq4" value="4"&gt; #include{}
  
  &lt;hr&gt;Question 5
  In PHP the error control operator is _______
  &lt;input type="hidden" name="qq5" value="null"&gt;
  &lt;input type="radio" name="qq5" value="1"&gt; .
  &lt;input type="radio" name="qq5" value="2"&gt; *
  &lt;input type="radio" name="qq5" value="3"&gt; @
  &lt;input type="radio" name="qq5" value="4"&gt; &amp;
  
  &lt;hr&gt;&lt;/font&gt;
  &lt;/pre&gt;
  &lt;input type="submit" value="Submit"&gt;
  &lt;/form&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>