title: How to automatically reload page after a certain time based on a php variable
body: <p>I currently have a php file that automatically plays the song at the top of a playlist. I have a <code>$duration</code> value that I pull from a mysql database and I want the page to automatically refresh after the song is finished playing.</p>
  
  <p>The song is currently played within an iframe so this is the only way to tell that the song has approximately finished. </p>
  
  <p>I've tried doing this in javascript but I'm having issues trying to pass a variable to the timeout period. </p>
  
  <pre><code>&lt;script type="text/JavaScript"&gt;
      function timedRefresh(timeoutPeriod{
          setTimeout("location.reload(true);",timeoutPeriod);
      }
  &lt;/script&gt;
  
  &lt;body onload="JavaScript:timedRefresh($x);"&gt;
      ...
  &lt;/body&gt;
  </code></pre>