How to automatically display data in textboxes?

Hi, I am trying to create a page where teachers will be able to input marks. So far what I have managed to develop is like this- the page shows the list of students with their names and roll numbers in the first and second column. In the third column, there is a text box to input the obtained marks and once it is filled and the user moves to the next textbox, I intend it to automatically calculate the grades and GPAs and show in the four and five column in two text boxes and here I am stuck now. To automatically calculate GPA I have coded a javascript function, but the problem is it shows GPA and Grade only for the student who is on the very top of the list. It doesn’t work for rest of the students or you can say textboxes. Would you please kindly help me to solve this problem?

I have snapshot of the problem. here is the link - http://oi56.tinypic.com/2622vpf.jpg and i have attached it with this message also.
Thanks in Advance

Here is the code that I have developed so far-

Total Mark <?PHP include("connect.php"); $query = "SELECT * FROM student WHERE batch= 'Eight-A' "; $result = mysql_query($query); $num = mysql_num_rows ($result); mysql_close(); if ($num > 0 ) { $i=0; while ($i < $num) { $studentname = mysql_result($result,$i,"studentname"); $studentid = mysql_result($result,$i,"studentid"); ?> <? include('pullgradesinfo.php'); ?>

<? ++$i; } } else { echo "No Record Found"; } ?>
Student Name
Student ID
Obtained Mark
Grade
GPA
Status
<? echo $studentid?>
Present Absent
Sponsor our Newsletter | Privacy Policy | Terms of Service