Wrox Programmer Forums
|
ASP Forms As of Oct 5, 2005, this forum is now locked. Please use "Classic ASP beginner" at http://p2p.wrox.com/forum.asp?FORUM_ID=54 or "Classic ASP Professional" http://p2p.wrox.com/forum.asp?FORUM_ID=56 instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP Forms section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 10th, 2003, 04:05 PM
Registered User
 
Join Date: Jul 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to write a statement in ASP

Hi,
I need to take information from a form and do a calculation with it. Basicall It is a look up table, and I have it working with on variable (i.e. - How many colors do you want on the fron), however now I need to add 3 more variable just like the one before (i.e How many colors do you want on back, How many colors do you want on the left and so on). I have the working code and I will paste it below, along with the code of what I am trying to do.
Thanks,
Jen

Working Code:
<%
style = request("style")
numC = CLNG( request("numberOfColors") )
qty = CLNG( request("quantityOrdered") )
%>
<%
dim total
Dim colorPriceTable

colorPriceTable =Array(_
Array(6, 12, 24, 48, 72, 144, 288, 500, 1000, 2001, 999999),_
Array(4, 2.5, 1.6, 1.15, 1.1, .9, .75, .65, .6, .55, .5),_
Array(7, 3.1, 2.45, 1.9, 1.5, 1.35, 1, .85, .8, .7, .65),_
Array(8.5, 4, 3, 2.85, 1.95, 1.65, 1.45, 1.3, 1, .85, .8),_
Array(10.5, 4.7, 3.6, 3.45, 2.35, 1.9, 1.7, 1.6, 1.3, 1, .9),_
Array(12, 5.4, 4.25, 4.05, 2.75, 2.2, 1.95, 1.9, 1.5, 1.15, 1),_
Array(13, 6.3, 5.05, 4.75, 3.35, 2.7, 2.35, 2.2, 1.7, 1.3, 1.1)_
)
%>
<%
priceRow = colorPriceTable(numC)
qtyRow = colorPriceTable(0)

For col = 0 To UBound(qtyRow)
  If qty < qtyRow(col) Then
    unitPrice = priceRow(col)
  Exit For
  End If
Next
total = ((((unitPrice * qty) + (style * qty) + (.25 * qty))* 1.54) + (numC * 22))

if style = 1.98 then
 styletemp = "Beefy-T"
      elseif style = 1.99 then
 styletemp = "T-Shirt 1"
end if
%>

What I am trying to do:
<%
style = request("style")
numC = CLNG( request("numberOfColors") )
numCb = CLNG( request("numberOfColorsb") )
numCr = CLNG( request("numberOfColorsr") )
numCl = CLNG( request("numberOfColorsl") )
qty = CLNG( request("quantityOrdered") )
%>
<%
dim total
Dim colorPriceTable

colorPriceTable =Array(_
Array(6, 12, 24, 48, 72, 144, 288, 500, 1000, 2001, 999999),_
Array(4, 2.5, 1.6, 1.15, 1.1, .9, .75, .65, .6, .55, .5),_
Array(7, 3.1, 2.45, 1.9, 1.5, 1.35, 1, .85, .8, .7, .65),_
Array(8.5, 4, 3, 2.85, 1.95, 1.65, 1.45, 1.3, 1, .85, .8),_
Array(10.5, 4.7, 3.6, 3.45, 2.35, 1.9, 1.7, 1.6, 1.3, 1, .9),_
Array(12, 5.4, 4.25, 4.05, 2.75, 2.2, 1.95, 1.9, 1.5, 1.15, 1),_
Array(13, 6.3, 5.05, 4.75, 3.35, 2.7, 2.35, 2.2, 1.7, 1.3, 1.1)_
)

%>
<%
priceRow = colorPriceTable(numC)
priceRowb = colorPriceTable(numCb)
priceRowr = colorPriceTable(numCr)
priceRowl = colorPriceTable(numCl)
qtyRow = colorPriceTable(0)

For col = 0 To UBound(qtyRow)
If qty < qtyRow(col) Then
unitPrice = priceRow(col)
unitPriceb = priceRowb(col)
unitPricer = priceRowr(col)
unitPricel = priceRowl(col)
Exit For
End If
Next

total = ((((unitPrice * qty) +(unitPriceb * qty) +(unitPricer * qty) + (unitPricel * qty) + (style * qty) + (.25 * qty))* 1.54) + (numC * 22))

if style = 1.98 then
 styletemp = "Beefy-T"
      elseif style = 1.99 then
 styletemp = "T-Shirt 1"
end if
%>

Thanks for You Help :)





Similar Threads
Thread Thread Starter Forum Replies Last Post
how to write sql statement for nested subuery thas123 SQL Server 2000 3 February 23rd, 2006 02:37 PM
Write from ASP.Net(c#) to excel venterjo General .NET 1 December 19th, 2004 11:51 PM
Can I write ASP code in Dreamweaver? Ben Horne Dreamweaver (all versions) 13 December 4th, 2003 04:00 PM
using asp to write javascript vivalet Classic ASP Basics 3 November 6th, 2003 02:02 PM
ASP Table write out aware Classic ASP Basics 2 September 18th, 2003 02:03 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.