I;m having probs with this script. when i
click update form the values from the text boxs that javascript updates
won't be saved in the data base.
Can any1 help?
Thanks
Kat
<script type="text/javascript">
function ptotal(x,z,r,h,g)
{
var y=document.getElementById(x).value
var d=document.getElementById(z).value
var f=document.getElementById(r).value
document.getElementById(h).value=parseFloat(y*3)+p arseFloat(d)
document.getElementById(g).value=parseFloat(y)+par seFloat(d)+parseFloat(f)
}
function gdtotal(x,z,h)
{
var s=document.getElementById(x).value
var k=document.getElementById(z).value
document.getElementById(h).value=parseFloat(s)-parseFloat(k)
}
</script>
*some code"
<form id="form1" action="admin.php?page=leagueedit" method="post"
enctype="multipart/form-data">
<input type="hidden" name="t_day" value="<?php echo date("d");?>">
<input type="hidden" name="t_month" value="<?php echo date("m");?>">
<input type="hidden" name="t_year" value="<?php echo date("Y");?>">
<?php
while ($row = mysql_fetch_array($numresults)) {
?>
<tr>
<td width="150"><? echo $row{'TEAM'};?></td>
<td><input type="text" size="3" id="<? echo "t_played" . $row{'id'};?>"
name="<? echo "t_played" . $row{'id'};?>" value="<? echo $row{'PLAYED'};?>"
disabled></td>
<td><input type="text" size="3" id="<? echo "t_won" . $row{'id'};?>"
name="<? echo "t_won" . $row{'id'};?>" value="<? echo $row{'WIN'};?>"
onchange="ptotal(this.id,'<? echo "t_draw" . $row{'id'};?>','<? echo
"t_lost" . $row{'id'};?>','<? echo "t_pts" . $row{'id'};?>','<? echo
"t_played" . $row{'id'};?>')"></td>
<td><input type="text" size="3" id="<? echo "t_draw" . $row{'id'};?>"
name="<? echo "t_draw" . $row{'id'};?>" value="<? echo $row{'DRAW'};?>"
onchange="ptotal('<? echo "t_won" . $row{'id'};?>',this.id,'<? echo "t_lost"
.. $row{'id'};?>','<? echo "t_pts" . $row{'id'};?>','<? echo "t_played" .
$row{'id'};?>')"></td>
<td><input type="text" size="3" id="<? echo "t_lost" . $row{'id'};?>"
name="<? echo "t_lost" . $row{'id'};?>" value="<? echo $row{'LOST'};?>"
onchange="ptotal('<? echo "t_won" . $row{'id'};?>','<? echo "t_draw" .
$row{'id'};?>',this.id,'<? echo "t_pts" . $row{'id'};?>','<? echo "t_played"
.. $row{'id'};?>')"></td>
<td><input type="text" size="3" id="<? echo "t_for" . $row{'id'};?>"
name="<? echo "t_for" . $row{'id'};?>" value="<? echo $row{'GFOR'};?>"
onchange="gdtotal(this.id,'<? echo "t_against" . $row{'id'};?>','<? echo
"t_gd" . $row{'id'};?>')"></td>
<td><input type="text" size="3" id="<? echo "t_against" . $row{'id'};?>"
name="<? echo "t_against" . $row{'id'};?>" value="<? echo
$row{'AGAINST'};?>" onchange="gdtotal('<? echo "t_for" .
$row{'id'};?>',this.id,'<? echo "t_gd" . $row{'id'};?>')"></td>
<td><input type="text" size="3" id="<? echo "t_gd" . $row{'id'};?>"
type="text" name="<? echo "t_gd" . $row{'id'};?>" value="<? echo
$row{'GD'};?>" disabled></td>
<td><input type="text" size="3" id="<? echo "t_pts" . $row{'id'};?>"
type="text" name="<? echo "t_pts" . $row{'id'};?>" disabled value="<? echo
$row{'PTS'};?>"></td>
</tr>
<? }?>
</table>
<input type="submit" name="submit" value="Update Table">
</form>