it is a code to submit several grades in one submission
this is the javascript code fore validation
function validateForm() {
var x='<?php echo ($grade);?>';
if (x>100) {
alert("Invalid Data Entry");
return false;
}
it is not accessing the variable grade in the third echo down
<form name="form1" method="post" action="insertgradeac.php"onsubmit="return validateForm()" method="post">
<?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 "<tr>
";
echo "<td>$row[0]<input type=\"hidden\" name=\"stt_ID[]\" value=\"$row[0]\" /></td>
";
echo "<td>$row[1]<input type=\"hidden\" name=\"student[]\" value=\"$row[1]\" /></td>
";
echo "<td><input type=\"text\" name=\"grade[]\" /></td>
";
echo "</tr>
";
}
mysql_close($con);
?>