I am trying to multiply values in two text boxes and place it on a third text box... Using javascript and php while loop with onclick event.....How to do that?? my code is
Try like this
while($c=mysql_fetch_array($b)) {
echo "
//Let you want to pass id from DB
";
or you can use
onkeypress='multiply('.$c['id'].')'
USE onkeypress instead of onclick() and in your script
function multiply(id)
{
var textValue1 = document.getElementById('CLS'+id).value;
var textValue2 = document.getElementById('rate'+id).value;
document.getElementById('valuation'+id).value = textValue1 * textValue2;
}
And try to avoid mysql_* functions because they are depricated,instead use either mysqli_* functions or PDO statements