Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Request.Querystring(variablevalue) possible?

I'm creating an application which uses request.querystring to transfer variables between pages. However at the moment I am setting variable names in the URL dynamically in accordance with an array and I want to retrieve these values on another page using (essentially) the same array. So I came up with what I thought would be the simple solution:

For Each x In AnswerIDs
    response.write(x)
    ctest = Request.Querystring(x)
    response.write(ctest)
Next

However this doesn't seem to work as it looks like you can't use Request.Querystring() with a variable as it's parameter. Has anyone got any idea how I could do this?

This is the query string:

QuizMark.asp?11=1&12=1

In this case AnswerIDs consists of "11" & "12" so in my loop I want it to write "1" & "1".

like image 314
howdybaby Avatar asked Mar 31 '26 02:03

howdybaby


1 Answers

You can loop through the querystring like this:

For Each Item in Request.QueryString
    Response.Write Item & ": " & Request.QueryString(Item) & "<br/>"
Next

Item contains the name of the querystring parameter, with Request.Querystring(Item) you retrieve the value of the parameter.

like image 125
kloarubeek Avatar answered Apr 02 '26 10:04

kloarubeek



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!