?
Solved

Passing an array to an active server page

Posted on 1998-07-24
1
Medium Priority
?
221 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 4

Accepted Solution

by:
mitek earned 200 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

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! 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…
It is a general practice to get rid of old user profiles on a computer  in a LAN environment. As I have been working with a company in a LAN environment where users move from one place to some other place at times. This will make many user profil…
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Suggested Courses

800 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