By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,921 Members | 1,466 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,921 IT Pros & Developers. It's quick & easy.

Using Radio buttons/checkboxes to add values into numeric calculations

P: n/a
I currently have a set of simple calculations to determine square footage
and multuply that by a dollar amount per foot. I use form fields that are
filled in by the user, and then the Submit button opens the asp page that
returns the result of the calculation. What I would like to do is add
certain numbers to the total based on radio buttons or checkboxes that the
user activates on the form page. For instance, they enter the numbers into
the form fields, and then if they check Radio Button 1, 100 is added to the
total on the asp results page. I tried using the "Value" attribute of the
Radio buttons and "+ cInt("RadioButtonName") in the results ASP code, but
this apparently should only be "on" or "off," not return custom values.

I am using Frontpage and very rudimentary ASP code. Can anyone help?

Thanks in advance, help is much appreciated. If you know a place that this
post is better posted, please let me know.

Newbie Supreme
Jul 19 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
You should show the code you are using. Anyway.

Page1.asp
<form method=post action=Page2.asp>
Enter the length <input name=theLength><br>
Enter the width <input name=theWidth><br>
How much extra would you like to pay?<br>
<input type=radio name=PayExtra value=100>$100
<input type=radio name=PayExtra value=10>$10
<input type=radio name=PayExtra value=1>$1
<input type=radio name=PayExtra value=0>$0
<br>
<input type=submit value="GO">
</form>

Page2.asp
<%
Dim lngLength
Dim lngWidth
Dim dblPayExtra
Dim lngSqrFeet
Dim dblBaseCharge

dblBaseCharge=10 'That is, $10 per square foot
lngLength=Request.Form("theLength")
lngWidth=Request.Form("theWidth")
dblPayExtra=Request.Form("PayExtra")
lngSqrFeet=lngLength*lngWidth

Response.Write "Your bill will be.....$" & (lngSqrFeet * dblBaseCharge)
+ dblPayExtra
%>
"Newbie" <ne***********@yahoo.com> wrote in message
news:be************@ID-69076.news.dfncis.de...
I currently have a set of simple calculations to determine square footage
and multuply that by a dollar amount per foot. I use form fields that are
filled in by the user, and then the Submit button opens the asp page that
returns the result of the calculation. What I would like to do is add
certain numbers to the total based on radio buttons or checkboxes that the
user activates on the form page. For instance, they enter the numbers into the form fields, and then if they check Radio Button 1, 100 is added to the total on the asp results page. I tried using the "Value" attribute of the
Radio buttons and "+ cInt("RadioButtonName") in the results ASP code, but
this apparently should only be "on" or "off," not return custom values.

I am using Frontpage and very rudimentary ASP code. Can anyone help?

Thanks in advance, help is much appreciated. If you know a place that this post is better posted, please let me know.

Newbie Supreme

Jul 19 '05 #2

P: n/a
Now THAT did the trick. You know, I tried using the value attribute of the
radio buttons, but I must have had the syntax wrong. I probably hadn't
declared the variables properly.

Thanks again!

Newbie Supreme

"Tom B" <sh*****@NOSPAMhotmail.com> wrote in message
news:#D*************@tk2msftngp13.phx.gbl...
You should show the code you are using. Anyway.

Page1.asp
<form method=post action=Page2.asp>
Enter the length <input name=theLength><br>
Enter the width <input name=theWidth><br>
How much extra would you like to pay?<br>
<input type=radio name=PayExtra value=100>$100
<input type=radio name=PayExtra value=10>$10
<input type=radio name=PayExtra value=1>$1
<input type=radio name=PayExtra value=0>$0
<br>
<input type=submit value="GO">
</form>

Page2.asp
<%
Dim lngLength
Dim lngWidth
Dim dblPayExtra
Dim lngSqrFeet
Dim dblBaseCharge

dblBaseCharge=10 'That is, $10 per square foot
lngLength=Request.Form("theLength")
lngWidth=Request.Form("theWidth")
dblPayExtra=Request.Form("PayExtra")
lngSqrFeet=lngLength*lngWidth

Response.Write "Your bill will be.....$" & (lngSqrFeet * dblBaseCharge) + dblPayExtra
%>
"Newbie" <ne***********@yahoo.com> wrote in message
news:be************@ID-69076.news.dfncis.de...
I currently have a set of simple calculations to determine square footage and multuply that by a dollar amount per foot. I use form fields that are filled in by the user, and then the Submit button opens the asp page that returns the result of the calculation. What I would like to do is add
certain numbers to the total based on radio buttons or checkboxes that the user activates on the form page. For instance, they enter the numbers

into
the form fields, and then if they check Radio Button 1, 100 is added to

the
total on the asp results page. I tried using the "Value" attribute of the Radio buttons and "+ cInt("RadioButtonName") in the results ASP code, but this apparently should only be "on" or "off," not return custom values.

I am using Frontpage and very rudimentary ASP code. Can anyone help?

Thanks in advance, help is much appreciated. If you know a place that

this
post is better posted, please let me know.

Newbie Supreme


Jul 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.