title: create php live clock
body: <p>How can i create a live clock with php that gets time from server not users pc time [not javascript]</p>
  
  <p>i used the below code but time stops when using php variable</p>
  
  <pre><code>&lt;form name="Tick"&gt;
  &lt;input type="text" size="12" name="Clock"&gt;
  &lt;/form&gt;
  &lt;script type="text/javascript"&gt;
  function show(){
      var hours="&lt;?php echo $myhour; ?&gt;"
      var minutes="&lt;?php echo $mymin; ?&gt;"
      var seconds="&lt;?php echo $mysec; ?&gt;"
      var dn="AM" 
      if (hours&gt;12){
          dn="PM"
          hours=hours-12
          //this is so the hours written out is in 12-hour format, instead of the default //24-hour format.
      }
      if (hours==0)
          hours=12
      //this is so the hours written out when hours=0 (meaning 12a.m) is 12
      if (minutes&lt;=9)
          minutes="0"+minutes
      if (seconds&lt;=9)
          seconds="0"+seconds
      document.Tick.Clock.value=
      hours+":"+minutes+":"+seconds+" "+dn
      setTimeout("show()",1000)
  }
      show()
  &lt;/script&gt;
  </code></pre>