472,121 Members | 1,454 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,121 software developers and data experts.

how will i compute the amount by using asp?

2
Im currently doing a simple application using html and asp. I would like an application that displays basic services. The application should be designed with checkboxes to select various services such as vaccination, dentistry, laboratory work, heartworm preventive and so on. As each services selected the charges for the services should display. After all selections have been made the charges should be added together to arrive at total amount. For example if you check the value of vaccination and its amount is 300.00 and if you check the value of dentistry ant its amount is 400.00 and the laboratory work is 500.00.. what is the amount? how will i compute it by using asp?
Oct 11 '07 #1
3 1106
pbmods
5,821 Expert 4TB
Heya, rekcip. Welcome to TSDN!

I'm going to go ahead and move this thread to the ASP forum, where our resident Experts will be better able to help you out.
Oct 11 '07 #2
markrawlingson
346 Expert 100+
After the user makes their selections and hits submit, you check to see if the form has been submitted, and then you check to see which checkboxes have been selected, and keep a tally of the total amount.

Expand|Select|Wrap|Line Numbers
  1. If Request.Form <> Empty Then ' if the form has been submitted and contains information
  2.    iTally = 0 ' Inialize a variable with a value of zero, so we can add to it.
  3.    If Request.Form("item1") = "on" Then ' if the checkbox "item1" has been checked by the user
  4.       iTally = iTally + 300
  5.       isCharge = true ' set a variable to see whether anything has been selected
  6.    End If
  7.    If Request.Form("item2") = "on" Then ' if the checkbox "item2" has been checked by the user
  8.       iTally = iTally + 400
  9.       isCharge = true
  10.    End If
  11.    'if items are being selected of monetary value, we need to add the laboratory charge to it, if they're not purchasing anything the iTally will return 0 and I'm *assuming* you don't want to add the laboratory charge in that case
  12.    If CBool(isCharge) = True Then
  13.       iTally = iTally + 500
  14.    End If
  15.    Response.Write "Your total charge is : " & FormatCurrency(iTally,2)
  16. End If
  17.  
Note that checkboxes return a value of "on" when they are checked, and DO NOT return any value when they are not checked.

Hope this helps.

Sincerely,
Mark
Oct 11 '07 #3
rekcip
2
After the user makes their selections and hits submit, you check to see if the form has been submitted, and then you check to see which checkboxes have been selected, and keep a tally of the total amount.

Expand|Select|Wrap|Line Numbers
  1. If Request.Form <> Empty Then ' if the form has been submitted and contains information
  2.    iTally = 0 ' Inialize a variable with a value of zero, so we can add to it.
  3.    If Request.Form("item1") = "on" Then ' if the checkbox "item1" has been checked by the user
  4.       iTally = iTally + 300
  5.       isCharge = true ' set a variable to see whether anything has been selected
  6.    End If
  7.    If Request.Form("item2") = "on" Then ' if the checkbox "item2" has been checked by the user
  8.       iTally = iTally + 400
  9.       isCharge = true
  10.    End If
  11.    'if items are being selected of monetary value, we need to add the laboratory charge to it, if they're not purchasing anything the iTally will return 0 and I'm *assuming* you don't want to add the laboratory charge in that case
  12.    If CBool(isCharge) = True Then
  13.       iTally = iTally + 500
  14.    End If
  15.    Response.Write "Your total charge is : " & FormatCurrency(iTally,2)
  16. End If
  17.  
Note that checkboxes return a value of "on" when they are checked, and DO NOT return any value when they are not checked.

Hope this helps.

Sincerely,
Mark
mark,
hello!! thanks.. good job!! it will help me a lot... thank u so much!!
Oct 12 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by pentium77 | last post: by
52 posts views Thread by Dick Moores | last post: by
1 post views Thread by Oberon | last post: by
4 posts views Thread by wutzke | last post: by

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.