validate variable with javascript
<p>it is a code to submit several grades in one submission<br>
this is the javascript code fore validation</p>

<pre><code>function validateForm() {
    var x='&lt;?php echo ($grade);?&gt;';

    if (x&gt;100) {
        alert("Invalid Data Entry");
        return false;
    }
</code></pre>

<p>it is not accessing the variable grade in the third echo down  </p>

<pre><code>&lt;form name="form1" method="post" action="insertgradeac.php"onsubmit="return validateForm()" method="post"&gt;

&lt;?php
    $con = mysql_connect($server, $username, $password);
    mysql_select_db($database);

    $query_fetch5 = "SELECT ass_class FROM assess WHERE ass_ID LIKE '$id'";
    $result_fetch5 = mysql_query($query_fetch5);
    $row5 = mysql_fetch_row($result_fetch5);
    $row5_0 = $row5[0];

    $query_fetch = "SELECT st_ID, st_name FROM student WHERE class_ID LIKE '$row5_0'";
    $result_fetch = mysql_query($query_fetch);

    while ($row = mysql_fetch_row($result_fetch)) {
        echo "&lt;tr&gt;\n";

        echo "&lt;td&gt;$row[0]&lt;input type=\"hidden\" name=\"stt_ID[]\" value=\"$row[0]\" /&gt;&lt;/td&gt;\n";
        echo "&lt;td&gt;$row[1]&lt;input type=\"hidden\" name=\"student[]\" value=\"$row[1]\" /&gt;&lt;/td&gt;\n";
        echo "&lt;td&gt;&lt;input type=\"text\" name=\"grade[]\" /&gt;&lt;/td&gt;\n";
        echo "&lt;/tr&gt;\n";
    }


    mysql_close($con);
?&gt;
</code></pre>
