How to pass a php variable($total) i have, to an External Javascript as in input?
<p>I have a php file with a variable $total as one of its variable.</p>

<p>AS part of my project I have to print a table of results.
I call an external javascript whenever i display the table, something like this </p>

<pre><code>echo "&lt;script src='course.js' language='JavaScript'&gt;&lt;/script&gt;";
echo "&lt;table border='1'&gt;";
echo "&lt;tr&gt;";
echo "&lt;td&gt;&lt;td&gt;";
</code></pre>

<p>Each row of this table has a checkbox, and i call the script file to check whether the number of checked boxes is not more than 8, for which i need the $total variable which is the total number of rows in the table</p>

<p>My course.js file looks like this (assuming $total)</p>

<pre><code>var count = 0;

for(i=1;i&lt;=$total;i++)
{
    if(document.getElementByTag('course."i"').checked==true)
      count++;
}

if(count==8)
{
    for(i=1;i&lt;total;i++)
    {
     document.getElementById('course."i"').disable=true;
    }
}
}
</code></pre>
