Using variables from previous ASP page

拟墨画扇 提交于 2020-01-07 06:28:11

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!