| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Calculate sales tax and employee discount on form
I have a form called "cash register".
The fields are to be executed in the following, EXACT sequence: 1) Retail Price (user types in a price) 2) Use Employee Discount? (user checks it to apply a 25% discount to the retail price; leaves it unchecked if he is not entitled to a discount) 3) Location (drop-down box contains Delaware, New Jersey, PA and PA-Philadelphia) - user selects his state to generate respective state tax 4) Calculate Total (user clicks to generate total price) I need help getting this code to calculate. Please review and correct my syntax. Thanks for your expertise! <html> <head> <meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1"> <title>Cash Register</title> </head> <body> <% DIM retailprice, location, employeediscount, calculatetotal, runningtotal retailprice = request.form("retailprice") location = request.form("location") employeediscount = request.form("employeediscount")'This is a checkbox variable. calculatetotal = request.form("calculatetotal") runningtotal = retailprice 'Use commands to view variables at top of page: response.write("retail price is: " & retailprice & "<br/>") response.write("location is: " & location & "<br/>") response.write("runningtotal is: " & runningtotal & "<br/>") if employeediscount = "on" then runningtotal = retailprice * (1 - .25) else runningtotal = retailprice end if calculatetotal = (location * retailprice)+ retailprice response.write("Total amount due is $" & calculatetotal & "<br/>") %> <form method= "post" action= "CashRegister.asp"> <h4>Retail Price:</h4> <input type="text" name="Retail Price" value="<% =retailprice%>"<br/> <h4>Use Employee Discount?:</h4> <input type ="checkbox" name="Employeediscount" value ="checkbox"/><br/> <h4>Location (for sales tax):</h4> <select name= "Location"> <option value="0">Delaware</option> <option value=".06">New Jersey</option> <option value=".06">Pennsylvania</option> <option value=".07">PA - Philadelphia</option> </select> <p> <input type= "submit" value="Calculate Total"/> </form> </body> </html> |
![]() |
| Viewing: ASP Free Forums > Programming > Code Bank > Calculate sales tax and employee discount on form |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|