Link to home
Start Free TrialLog in
Avatar of greta13
greta13

asked on

Adding two text fields together to a third total text fields

I have a form that I want to pass an "amount" variable to paypal.    My user has two distinct sets of radio buttons that feed two text boxes and I would like to add those two text boxes on the fly to a third text box showing the total before the user passes that value to paypal builtin "amount" variable.  I am using paypal toolkit and have not found a way to manipulate these variable after the form is posted to my processing page.  I don't want to use javascript but have not found another method in my searches.  Here is my code...can you help me to get this to work...Secondarily does anyone know where I can find some documentation for the php toolkit..I am solely dependent on their read me file..this is not my primary question..thx for the help
<html>
 
 
<head>
   
     <script language="JavaScript" type="text/JavaScript">
 
     function add() {
     var total= ((document.test.abc.value*1) + (document.test.abd.value*1));
     document.test.total.value=total;
     }
     </script>
</head>
 
 
 
<body>
<center>
<form name="test">
<input type=radio name=R1 value=40.00 onclick="document.test.abc.value=
 
this.value">40.00<br>
<input type=radio name=R1 value=50.00  onclick="document.test.abc.value=
 
this.value">50.00
 
<br><br>
<br>
<input type=radio name=R2 value=5.00 onclick="document.test.abd.value=
 
this.value">5.00<br>
 
<input type=radio name=R2 value=10.00 onclick="document.test.abd.value=
 
this.value">10.00<br>
 
<input type=radio name=R2 value=15.00 onclick="document.test.abd.value=
 
this.value">15.00<br>
<input type=text name=abc onchange="add();" value ="" >
<input type=text name=abd onchange="add();" value ="">
<input type=text size="5"  name=total  >
<input type="reset" name="reset">
</form>
</center>
</body>
 
</html>

Open in new window

Avatar of hielo
hielo
Flag of Wallis and Futuna image

var total= ( parseInt(document.test.abc.value*1) + parseInt(document.test.abd.value*1));
Avatar of greta13
greta13

ASKER

This has to be put in the head as part of a function doesn't it?
ASKER CERTIFIED SOLUTION
Avatar of hielo
hielo
Flag of Wallis and Futuna image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of greta13

ASKER

Thanks
glad to help