Resources
| Pass values of your array from one page to another |
| Posted by : Amit Agarwal |
Total Hits : 33342 |
How often have you wanted to pass information in a array from one page to another ? I wanted to do it many times but used many things like session variables and application variables till I found the better way of doing it ! Using Split and Join Functions. Join() can put the values of your data in a array in a string seperated by a given charater. This data can then be put into a querystring and then be passed to the next page. You can now retrieve the values in the querystring and Split() them. Just use the function with the same character you has used to join them. And you have the data in a new array.
|
|
|
Get the Source Code.
Firstpage
Your Array
Dim myArray(3) myArray(0) = "Item 1" myArray(1) = "Item 2" myArray(2) = "Item 3" myArray(3) = "Item 4"
Now lets Join them using a comma. You can use any other character that you wish to use data = join(myarray, ",")
Now lets send this data to another page Response.redirect "nextpage.asp?data="&data
Nextpage
Now lets retrieve the data newdata = request.querystring("data")
Lets Split them newarray = split(newdata,",")
You can process the data in your array as you like.
|
|
|
|
 |
|
 |