hi,
i need to calculate the sum of all text boxes in to a single text box.
assume:
text box1=100, totaltextbox should be 100,
If i enter,
textbox1=250,textbox2=200.When i enter value to the textbox1,total should be 250.once i enter the second value to the textbox2,total should change to 450.it just like a onchange function.
Hope everyone got my point.
Please help me to solve this as soon as possible.
thanks in advance.......
calculate sum of all text boxes
Moderator: General Moderators
Re: calculate sum of all text boxes
If you mean dynamically, then i guess you have to use Java.
Re: calculate sum of all text boxes
no this is not happening dynamically.Totally i got 30 text boxes.i need to calculate sum of that 30 text boxes.But sometimes user might enter all the text boxes or few of them. do you have any idea to do that?
Re: calculate sum of all text boxes
Wrong section. Try posting it in the JavaScript section.
- AbraCadaver
- DevNet Master
- Posts: 2572
- Joined: Mon Feb 24, 2003 10:12 am
- Location: The Republic of Texas
- Contact:
Re: calculate sum of all text boxes
Using PHP and calculating on submit, you would name your text boxes like so: name="textbox[]". Then on the resulting page you can sum them all:
Dunno if that's what you're going for.
Code: Select all
$total = array_sum($_POST['textbox']);mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.