Hi there!

I hope one of you javascript experts can help me out on this one. In html and PHP I made a purchase script. Al the products are listed inside a WHILE loop. The problem is, when I POST it starts entering data in the database. I would like the possibility that when I enter a number in the "aantal" field that it instantly calculates live how much it is going to cost.

So, "aantal$i" * inkoop_prijs = Subtotal
And, all Subtotals together = Total

Big respect to the one that solves this

if(isset($leverancier_id)) { 
$i = 1; 
$totaal = 0;
while($prodinfo = mysql_fetch_assoc($prodres)) {  

		<td align="center"><input name="aantal<?=$i;?>" type="text" value="" size="5" /></td>
		<td><?=number_format($prodinfo['inkoop_prijs'], 2);?></td>	
		<td align="right">Subtotal</td>
		<input type="hidden" name="product_id<?=$i;?>" value="<?=$prodinfo['product_id'];?>" />
		<input type="hidden" name="inkoop_prijs<?=$i;?>" value="<?=$prodinfo['inkoop_prijs'];?>" />

} }

		<td colspan="2" valign="top" align="right"><strong>Totaal:</strong></td>
		<td colspan="2" valign="top">incl. 19% BTW </td>
		<td align="right"><strong>Total</strong></td>