The above code will get the user information from page "getuser.php". The output of getuser.php has some numericals populated in 5 rows. The 6th row i.e., the table footer has the sum of all numericals populated in the above 5 rows.

The numericals in the first 5 rows are populated in textboxes. The issue here is, after the data is loaded in the main page and I try to edit the numericals in the textboxes, the sum (totals) present in the 6th row are not affected. How do I call the same function after I edit data in textboxes in the main page.

Please help...

	<script type="text/javascript">
		function showUser(str)
			var url="getuser.php";
			if (window.XMLHttpRequest)
			{// code for IE7+, Firefox, Chrome, Opera, Safari
				xmlhttp=new XMLHttpRequest();
			{// code for IE6, IE5
				xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
				if (xmlhttp.readyState==0 || xmlhttp.readyState==1 || xmlhttp.readyState==2 || xmlhttp.readyState==3 || xmlhttp.readyState==4)
				if (xmlhttp.readyState==4 && xmlhttp.status==200)

		Select a User:
		<select name="users" onchange="showUser(this.value)">
			<option value="1">A</option>
			<option value="2">B/option>
			<option value="3">C</option>
			<option value="4">D</option>
	<br />
	<div id="txtHint">
		<b>Person info will be listed here.</b>




$con = mysql_connect('localhost', 'username', 'password');

if (!$con)
  die('Could not connect: ' . mysql_error());

mysql_select_db("[dbname]", $con);

$sql="SELECT * FROM [table_name] WHERE login = '".$q."'";

$result = mysql_query($sql);

echo "<table border='1'>

while($row = mysql_fetch_array($result))
  echo "<tr>";
  echo "<td>" . $row['sname'] . "</td>";
  echo "<td>" . $row['fname'] . "</td>";
  echo "<td>" . $row['maths'] . "</td>";
  echo "<td>" . $row['physics'] . "</td>";
  echo "<td>" . $row['chemistry'] . "</td>";
  echo "</tr>";
echo "</table>";


If you set an on change event for the fields that you want to affect the totals at the bottom you can detect when the user makes a change in the input boxes and then update the totals field (and also make an ajax call to update the db). An input with an onchange event could look like this:

<input type='text' onchange='handleOnTextUpdate(this)' id='someIdHere' />