Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 464
  • Last Modified:

iterate through passed URL params

Hi

I have the following code which works if I pass a querystring such as mypage.asp?a=hi&b=test&c=three&d=fist etc....

I want to be able to just pass a set of parameters to the page such as mypage.asp?hi,test,three,fist and let it just deal with however many are sent, how can I achieve this please

I then ned to pass these to the window operner function which for some reason needs everything with ' around otherwise I get obj1 is null errors

Regards
Neil

<html>

    <head>

    <title></title>

        <script language="javascript">

            function passBackArgs() {
            
                a = '<% =Request.QueryString("a") %>';
                b = '<% =Request.QueryString("b") %>';
                c = '<% =Request.QueryString("c") %>';
                d = '<% =Request.QueryString("d") %>';
                e = '<% =Request.QueryString("e") %>';
                f = '<% =Request.QueryString("f") %>';
             
                try {            
                    window.opener.jspassback(a,b,c,d,e,f);    
                    self.close();
                } catch(e) {
                    alert(e);
                    //alert("Parent Window is Closed!");
                }
            }
        </script>

    </head>

    <body onload="javascript: passBackArgs();"></body>

</html>

Open in new window

0
Neil Thompson
Asked:
Neil Thompson
  • 3
  • 2
  • 2
  • +1
1 Solution
 
Barry62Commented:
You can't just pass values in a url.  The there has to be a name-value pair.  That's the only way it works.
0
 
dimmergeekCommented:
I have had success in passing values like this:

"page.asp?vals=a,b,c,d,e,f,g,h"

You can get your values string from the Request.QueryString and then dump your data into an array after slippting based on the comma.
Then, you just cound how many elements you have in your array and you should be set.
0
 
Neil ThompsonSenior Systems DeveloperAuthor Commented:
Thanks dimmergeek that sounds like what im after but how would I achieve that?

I'm not too up with asp any more.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
dimmergeekCommented:
dim str, arrSplit

str = Request.QueryString("values")
arrSplit = Split(str, ",")

i = 0
Do While i <= UBound(arrSplit)
     Add your code to execute for each value retuned here...
Loop

Open in new window

0
 
hieloCommented:
You can't just pass values in a url.  The there has to be a name-value pair.  That's the only way it works.
Actually, that is not true. You can get it from the Request.ServerVariables() Collection. Try:

Dim data
data=Split(Request.ServerVariables("QUERY_STRING"), ",")
For i=0 To UBound(data)
Response.Write data(i) & "<br >"
Next

Open in new window

0
 
Neil ThompsonSenior Systems DeveloperAuthor Commented:
just what I needed, many thanks
Neil
0
 
dimmergeekCommented:
You're welcome.  Thanks for the points!
0
 
Barry62Commented:
Thank you for the points!
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 3
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now