Solved

Passing an array to an active server page

Posted on 1998-07-24
1
192 Views
Last Modified: 2013-12-25
Is it possible to pass an array to an active server page, using
the post method, as in
URL?array=array_name(5)&size_of_array=5

or in some simialr way.
I have to pass about 20 values to the asp.
      If it is not possible to pass an array would
it be O.K. to pass them as single arguments, i.e.
having 20 vaules listed after the URL.
      Is there any other way to achieve this goal.
Thanks in advance
0
Comment
Question by:martythegreat
1 Comment
 
LVL 4

Accepted Solution

by:
mitek earned 100 total points
ID: 1831148
Of course, it's possible. The specs were designed in such a way so that to allow passing multiple arguments with the same name via GET or POST methods.

The idea is to do something like:

script.asp?array_name=5&array_name=8&array_name=some_text&array_name=abc&other_array=5&other_array=10 ... etc.

and the like. If there are duplicate names in the get (post data) string, they will be treated as an array. This way one can pass several arrays to an asp script.

The good news is that it keeps the order of values, too ! In one application, I actually was passing two arrays of values (along with several standalone vars) using the method described above -- one array of value ids, and the other one -- of values (to be inserted into a database). And they ALWAYS matched -- meaning, they translated into array exactly in the order they apperad in GET (POST) string

In ASP, if it's VBScript, just treat the
Request.Query("array_name") as an array.

Of course, it's possible also to pass array in single variable, following certain naming convention, if you know in advance how many values you'll have. Like,
script.asp?array_name1=5&array_name2=8&array_name3=some_text&array_name4=abc&other_array1=5&other_array2=10 ...

but it's much more limiting -- using the first method, you don't need to know the array size.
 
BTW, POST and GET methods use pretty much the same conventions about passing arguments.









0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial will discuss the log-in process using WhizBase. In this article I assume you already know HTML. I will write the code using WhizBase Server Pages, so you need to know some basics in WBSP (you might look at some of my other articles abo…
Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now