问题
On my first page I have an array defined as:
dim selection
selection = Array("name", "city")
On the following ASP page I'd like to call the same variables but I'm having a hard time figuring out how. This has been my basic structure as I attempt different solutions but this does not work, my results are always blank because I don't think I'm calling the variables correctly:
dim userselect
userselect = request.form("selection(0)")
dim cityselect
cityselect = request.form("selection(1)")
If I can do this in VBS great, if I can do this in Javascript, awesome, but I'm not sure where to start and would appreciate some help.
回答1:
You have some options,
Or you put the values inside an html form on the first page and post it to the second page and then request.form values;
Or you call the second page and pass the values by the caller name (ex. page2.asp?varname=varvalue), then you request.querystring these values on your second page;
Or you use session variables. Ex.: session("varname")=varvalue then you get it on second page by this way session("varname"). For example: response.write(session("varname")).
As you're using arrays, things gets complicated, but just a bit. You've already know how to deal with'em.
来源:https://stackoverflow.com/questions/38404010/using-variables-from-previous-asp-page