Hi Friends
I am using dynamic text box, i want to calculate the amount from value of rate in the text box and qty
Pls help me how to solve it...
<?php
include("config.php");
?>
<script type=text/javascript>
function multiply(){
a = document.getElementById("rate").value;
b = document.getElementById("qty").value;
c = a*b;
amt =
alert(c);
}
</script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<form action="" method="get" name="test">
<table width="800" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center">S.No</td>
<td align="center">Item Name</td>
<td align="center">Item Code</td>
<td height="30" align="center">Rate</td>
<td align="center">QTY</td>
<td align="center">Amount</td>
</tr>
<tr>
<?php $desr="select * from site_rate where category_code='EWS001' AND sitename='Amber' order by item_code";
//echo $desr;
$r=mysql_query($desr,$conn);
$i=1;
while($m=mysql_fetch_array($r))
{
?>
<td><?php echo $i; ?></td>
<td><textarea name="cat_item" cols="25" rows="2"><?php echo $m['category_item'];?></textarea></td>
<td><?php echo $m['item_code'];?></td>
<td><input name="rate" type="text" id="rate"/></td>
<td><input name="qty" type="text" id="qty" onchange="multiply()"/></td>
<td><input name="amt" type="text" /></td>
</tr><?php $i++; } ?>
</table>
</form>
</body>
</html>