This is a discussion on "Question about forms" within the Classic ASP section. This forum, and the thread "Question about forms are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
Question about forms
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
Question about forms
Ok, bare with me, as I'm 100% newbie to asp.
I've got a series of items each item has itemName, itemDescription, and itemPrice. Let's say I have 8 of them. Ok, what I've done so far is created an array: intMaxProduct = 9 intMaxArraySize = 3 Dim strParts2Darray( (intMaxProduct - 1), (intMaxArraySize - 1) ) strParts2Darray(0,0) = "Widgets" strParts2Darray(0,1) = "This widget contains a wedge-shaped wedge." strParts2Darray(0,2) = 1699.00 etc... Now, the next thing I do is an attempt manipulate this array. So, along with doing that, I also create a table to display the contents of the array. The next step is to eventually, pull this information from a database... which will be my next set of questions If Request.Form("Submit") <> "" Then For intProductCounter = 0 to ( intMaxProduct - 1 ) varFrmQty = "frmQty_" & intProductCounter if EXECUTE(Request.Form(""" & varFrmQty & """)) > 0 Then dblSubTotal = dblSubTotal + (strParts2Darray(intProductCounter,2) * EXECUTE(Request.Form(""" & varFrmQty & """))) End If Next dblTax = CDbl(Request.Form("frmTax")) dblShipping = CDbl(Request.Form("frmShipping")) dblTotal = dblTax + dblShipping + dblSubTotal End If Response.Write "<form action=""howtobuy.asp"" method=""post"" name=""frmproduct"" id=""frmProduct"">" Response.Write "<table border=""0"" width=""388"" cellpadding=""0"" cellspacing=""0"" class=""text"">" Response.Write "<tr><th>Qty</th><th>Product</th><th>Description</th><th>Price( $USD )</th></tr>" For intInnerCounter = 0 to ( intMaxProduct - 1 ) Response.Write "<tr>" strfrmQty = "frmQty_" & intInnerCounter Response.Write "<td><input name=""" & strfrmqty & """ type=""text"" id=""" & strfrmQty & """ value=""0"" size=""4"" maxlength=""4"" /></td>" For intOutterCounter = 0 to ( intMaxArraySize - 1 ) If intOutterCounter = 1 Then Response.Write "<td class=""text_sm"">" & strParts2Darray(intInnerCounter, intOutterCounter) & "</td>" Else Response.Write "<td>" & strParts2Darray(intInnerCounter, intOutterCounter) & "</td>" End If Next Response.Write "</tr>" Next %> Ok, after the brief background... here's my concern, all the tutorials I see that deal with forms, none of them produce it the way I do. They actually type out the the table and place all the info then use asp to grab all the elements. Even though, I'm creating the table programmitically, will i still be able to grab the elements? Is there a better way to do this? |
|
|
|
||||
|
I would definitly rewrite the initial part of that code to this:-
__________________
Rob - SEO Specialist Owner & Founder of Webforumz.com I am currently unavailable for private work
Last Blog Entry: Creative Labs threaten developer over home made drivers.... (Apr 1st, 2008)
|
|
|||
|
ok, I've gotten things to work so far; however, after I calculate, my quanity for whatever item(s) being purchased returns to zero. Do I need to insert a varible there like, <%= dblQty_# %>?
Also, I can't seem to get it to print doubles, like "$5.00" or $5.50". It shows as "$5" or "$5.5"... any ideas? |
|
|||
|
You have to use the FormatCurrency function. I use this page http://www.w3schools.com/vbscript/vb..._functions.asp a lot for a reference.
jakyra |
![]() |
| Tags |
| question, forms |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Forms | crackafaza | Web Page Design | 3 | Aug 13th, 2007 02:16 |
| Slightly embarassing forms question:-) | Michaeln | Web Page Design | 3 | Feb 19th, 2007 14:01 |
| forms | mickc90 | PHP Forum | 3 | Aug 1st, 2006 22:06 |
| Quick, random question (Forms) | SephirGaine | PHP Forum | 5 | Jul 2nd, 2006 20:53 |
| Help with forms ... | Drysdale | Web Page Design | 3 | Jun 9th, 2005 08:34 |