473,513 Members | 2,412 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using Radio buttons/checkboxes to add values into numeric calculations

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
2 8164
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
3411
by: Emmett Power | last post by:
Hi, I have a form on a web page with a number of radio buttons bound to the same field. Is it possible to set up the form so that users can select more than one radio button to submit multiple values to a field in the way that you can, for example, in a drop down field? Thanks in advance for any suggestions. With regards
9
2954
by: Gary | last post by:
Hello, Is it possible to dynamically update a textbox with words chosen from a list using form checkboxes and javascript? Gary
1
6130
by: sman | last post by:
Hi, I recently read this article on About.com on how to create required fields for a form: http://javascript.about.com/library/scripts/blformvalidate.htm Everything works great except that there are no instructions on how to make checkboxes and radio buttons required. I've tried adding these to my form, but I'm having no luck. Anyone know...
3
2337
by: ewitkop90 | last post by:
Here is my code: <SCRIPT> function transportchange(transport) { if (framenewinstall.Helpdesk.checked) framenewinstall.Helpdesk.checked=false; if (framenewinstall.CircuitNumber.checked) framenewinstall.CircuitNumber.checked=false; switch (transport) { case 0: Helpdesk.innerText="No Info Needed";
2
3216
by: jimi_xyz | last post by:
Sorry if this isn't the correct group, i don't think there is a group for straight HTML. I am trying to create a type of search engine. There are two radio buttons at the top, in the middle there is a text box, with the search button next to it, and at the bottom there are four check boxes. When the form loads one of the two radio buttons are...
4
2833
by: TS | last post by:
My objective: To create a survey that asks people to rate a list of things in order of importance. I wish to prevent them from just rating every item in the list the same value. For example the Page would look roughly like this: Please rate the following in order of importance: Item Rating Apples 1 2 3 Orange 1 2 3
24
19896
by: Mike Otten | last post by:
Any help greatly appreciated. The validated page is at: http://myweb.stedwards.edu/michaelo/ddtab.htm The trouble is with the radio buttons (2/3-down the left column). The radios are displaying a line above their respective labels. Here are the html and css snippets: <fieldset class="radio"> <legend>Credit card</legend>
11
2057
by: tracy.cooperjr | last post by:
I have four checkboxes. I want only one of them to be checked at a time. Any ideas?
3
5130
by: mountain.dog | last post by:
I have a query that shows a list of options that a user can toggle on or off using a checkbox. query... form... while($row = mysql_fetch_array($result))... <input name="menu_show_attribute" type="checkbox" class="checkbox"'); if ($row == 1) { echo (' value="'.$row.'" checked />
0
7394
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7123
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7542
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
4756
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3248
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3237
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1611
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
811
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
470
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.