Solved

Passing an array to an active server page

Posted on 1998-07-24
1
196 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

In this tutorial I will show you how to provide a dynamic RTF document on your website generated with data from your database. For this tutorial you will need Microsoft Word or WordPad, WhizBase and Microsoft Access. In this tutorial I will show …
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
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.

809 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