navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

Microsoft MVP

 

array in a loop

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> array in a loop
Page: [1]
 
wizard_oz

 

Posts: 140
Joined: 9/3/2004
From: Ga,USA
Status: offline

 
array in a loop - 4/2/2005 7:10:24   
Hey, I have some variables from another page and I used the request to get it to an ARRAY, How do I make it in a look for eg:
this doesn't work:
dim arrSend(2)
for i=1 to 2
arrSend(i)=Request.QueryString("arrSend(i)")
next
for i=1 to 2
Response.Write arrSend(i)
next
but this is working:
dim arrSend(10)
arrSend(1)=Request.QueryString("arrSend(1)")
arrSend(2)=Request.QueryString("arrSend(2)")
Response.Write arrSend(1)
Response.Write arrSend(2)
WHY???????
yogaboy

 

Posts: 377
Joined: 5/22/2004
Status: offline

 
RE: array in a loop - 4/2/2005 8:15:19   
Hi Wiz,

Arrays are numbered from 0, so ArrSend(2) has 3 spaces - 0, 1, 2. I don't understand why you start your FOR loops at 1, they should probably start at 0.

Also, you could bypass all this by using a SPLIT function. If you have 5 checkboxes with the same name...

myArrSend = Request.QueryString("arrSend")

myArray = SPLIT(myArrSend)

For i = 0 to Ubound(myArray)
Response.write myArray(i)
Next

Ubound is the upper bound or "top" of the array, which in this example will equal 4 because there are 5 items (0, 1, 2, 3, 4). SPLIT creates a zero-dimension array and puts the bit in the brackets into it, usually by delimiting by commas or spaces.

Hope that helps
Iain


< Message edited by yogaboy -- 4/2/2005 8:33:01 >

(in reply to wizard_oz)
yogaboy

 

Posts: 377
Joined: 5/22/2004
Status: offline

 
RE: array in a loop - 4/2/2005 8:45:53   
Now I've read your other post I geddit a bit more.

Try this

For i = 1 To Request.QueryString("arrSend").Count
Response.Write Request.QueryString("arrSend")(i) & "<br />"
Next

(in reply to yogaboy)
wizard_oz

 

Posts: 140
Joined: 9/3/2004
From: Ga,USA
Status: offline

 
RE: array in a loop - 4/7/2005 2:48:00   
Thanks I will try it

(in reply to yogaboy)
rdouglass

 

Posts: 9269
From: Biddeford, ME USA
Status: offline

 
RE: array in a loop - 4/7/2005 8:33:33   
quote:

myArray = SPLIT(myArrSend)


This line here will cause you some issues. You need to tell the SPLIT function where to slit at. You need something like:

myArray = SPLIT(myArrSend,",")

If you're requesting a list of multiple values like checkboxes or multi-select dropdowns, that code will split the string at each comma.

That any help?

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to wizard_oz)
wizard_oz

 

Posts: 140
Joined: 9/3/2004
From: Ga,USA
Status: offline

 
RE: array in a loop - 4/10/2005 2:08:45   
I think so, I will try it and let you know, Thanks again

(in reply to rdouglass)
Page:   [1]

All Forums >> Web Development >> ASP and Database >> array in a loop
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts