title: how to store javascript value in php variable
body: <p>I have this code. </p>
  
  <p>It's working fine for first var but its showing undefined variable for second. </p>
  
  <p>How I suppose to solve this?</p>
  
  <p>Here is my code:</p>
  
  <pre><code>&lt;script&gt;
    var p1 = "success";
    var time = document.getElementById("time").innerHTML;
  &lt;/script&gt;
  
  
  &lt;body&gt;
    &lt;div id="time"&gt;04:00&lt;/div&gt;
    &lt;?php
       echo "&lt;script&gt;document.writeln(p1);&lt;/script&gt;";
       echo $timevalue = "&lt;script&gt;document.writeln(time);&lt;/script&gt;";
    ?&gt;
  </code></pre>