469,323 Members | 1,412 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,323 developers. It's quick & easy.

ASP Quantity for a form (NOT USING DATABASE)

Hi, I'm pretty new to ASP so please bear with me...

My client would like me to create an order form that allows her customers to order her book and enter the quantity if they want more than one book. She wants it all done on one form on one page, so they click whether they want the audio download or paperback book and then they can type a quantity for each. I've had some issues creating a code that calculates a total and sends all sets of data needed for the merchant (amount, quantity, and version). Everything I've done just doesn't calculate.... Is there a way to do this without having to create a database??

Thanks in advance for any help!!
Sep 19 '07 #1
1 1121
Definitely there is! So I'm guessing on your first web page you've got a radio button (named radOrder for example with values of "paperback" and "audio"), you've got a textbox for the quantity (txtQuantity), and a submit button. All of these contained within a <form> element set to post the results to a the next page (named processOrder.asp for example).

On the processOrder.asp page you'll want to have code like this:
Expand|Select|Wrap|Line Numbers
  1. <%@SCRIPT language="vbscript"%>
  2. tOrder = Request.Form("radOrder")
  3. tQuantity = Request.Form("txtQuantity")
  4.  
  5. if tOrder = "paperback" then
  6. tPrice = 50.75
  7. else
  8. tPrice = 25.00
  9. end if
  10.  
  11. tTotalCost = tPrice * tQuantity
  12.  
  13. Response.Write(tTotalCost)
  14.  
And then do whatever else you want with the total cost. Hopefully my syntax is correct.. I haven't used ASP in a while.

Hope this answers your question!
Sep 19 '07 #2

Post your reply

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

By using this site, you agree to our Privacy Policy and Terms of Use.