I have inserted a Update Button to each row. The button should take from just the textboxes in the row and preform an update in "total_Update.php" using the post method.
<script language="javascript" type="text/javascript">
function Button_update(){
??enter row:idt,datetime,col1,col2 and col3 to be updated
document.forms.formupdate.submit();
}
</script>
<?php
echo '<form name="formupdate' , $data['idt'] , '" action="total_Update.php" method="post">';
echo '<center><table><tr><td><br /><br /><br /><br /></td></tr><tr><th>idt</th><th>datetime</th><th>col1</th><th>col2</th><th>col3</th></tr>';
$n=0;
while ($data = mysql_fetch_array($result, MYSQL_ASSOC)) {
if ($data['idt'] !== null) {
$n=$n+1;
<tr><td>';
echo '<input name="Text' , $n , '" type="text" value= "' , $data['idt'] , '" width="25" />', '</td>';
$n=$n+1;
echo '<td>', '<input name="Text' , $n , '" type="text" value= "' , $data['datetime'] , '" width="25" />', '</td>';
$n=$n+1;
echo '<td>', '<input name="Text' , $n , '" type="text" value= "' , $data['col1'] , '" width="25" />', '</td>';
$totalcol1=$totalcol1+$data['col1'];
$n=$n+1;
echo '<td>', '<input name="Text' , $n , '" type="text" value= "' , $data['col2'] , '" width="25" />', '</td>';
$totalcol2=$totalcol2+$data['col2'];
$n=$n+1;
echo '<td>', '<input name="Text' , $n , '" type="text" value= "' , $data['col3'] , '" width="25" />', '</td>';
$totalcol3=$totalcol3+$data['col3'];
echo '<td>', '<input name="ButtonUpdate' , $data['idt'] , '" type="button" value= "Update" OnClick="Button_update" width="25" />', '</td>';
}
}
echo '<tr><td><input name="Hidden1" type="hidden" /></td><td></td>';
echo '<td>', '<input name="Texttotalcol1" type="text" value= "' , $totalcol1 , '" width="25" />', '</td>';
echo '<td>', '<input name="Texttotalcol2" type="text" value= "' , $totalcol2 , '" width="25" />', '</td>';
echo '<td>', '<input name="Texttotalcol3" type="text" value= "' , $totalcol3 , '" width="25" />', '</td></tr>';
echo '</table></center></form>
?>