You cannot have multiple tags with the same id. Your code will output multiple instances of and .
You should serialise them, like this:
<?php
include("config.php");
?>
<script type=text/javascript>
function multiply(id){
var a;
var b;
var c;
a = document.getElementById("rate" + id).value;
b = document.getElementById("qty" + id).value;
document.getElementById("amt" + id).value = a * b;
}
</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<?php echo $i; ?>" type="text" id="rate<?php echo $i; ?>"/></td>
<td><input name="qty<?php echo $i; ?>" type="text" id="qty<?php echo $i; ?>" onchange="multiply(<?php echo $i; ?>)"/></td>
<td><input name="amt<?php echo $i; ?>" type="text" id="amt<?php echo $i; ?>" /></td>
</tr><?php $i++; } ?>
</table>
</form>
</body>
</html>