Jump to content

auto calculate the difference


michelle1404

Recommended Posts

Hello,

 

I want to calculate the difference between 2 textbox value live. 

 

I found this solution for adding http://forums.phpfreaks.com/topic/131592-solved-get-the-sum-of-many-text-box-values/  , but dont know how to convert this for subtracting

 

here is my form

echo '<tr><td></td><td style="text-align:center;">TOTAL</td><td style="text-align:center;"><input type="text" readonly="readonly" name="payamount" value='.$total.' style="text-align:center; font-weight:bold; font-size:13px;" ></td></tr>';
echo'<form name="form1" method="post" action="" >
<tr><td></td><td style="text-align:center;">Advance</td><td style="text-align:center;"><input type="text" name="advance" ></td></tr>
<tr><td></td><td style="text-align:center;">Discount</td><td style="text-align:center;"><input type="text" name="discount" ></td></tr>
<tr><td></td><td style="text-align:center;">Total Payable</td><td style="text-align:center;"><input type="text" name="total" id="total"/></td></tr>
<tr><td><input type="submit" name="submit" value="PAY NOW" >

when i enter the value for advance and discount, it should subtract these values with Total and should get entered in Total Payable text box

Link to comment
https://forums.phpfreaks.com/topic/289046-auto-calculate-the-difference/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.