I an new and I an stuck. I'm using Microsoft Visual Studio 2003 to create a simple form for a class project. The form needs to conform to the following sequence:
1) User inputs a retail price
2) User checks off Employee discount of 25%(where applicable)
3) User selects location from drop-down box
4) User presses calculation button to retrieve TOTAL price
Here's my syntax. Dont laugh. What went wrong? I need the calcualtion to work and for the info to REMAIN on the screen AFTER the user presses the Calculate Total button.
Thanks so much. Please post here or to my email:
[email protected].
I need an answer before 4PM today. Thanks for your expertise! :-)
<%
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")'Should calculate when button is pressed
discount = request.form("discount")
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" name="calculatetotal"/>
</p>
<input type="hidden" value=".25" name="discount"/>
</form>
</body>
</html>