使用上一个ASP页面中的变量 [英] Using variables from previous ASP page

查看:100
本文介绍了使用上一个ASP页面中的变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的第一页上,我定义了一个数组:

On my first page I have an array defined as:

dim selection
    selection = Array("name", "city")

在下面的ASP页面上,我想调用相同的变量,但是我很难弄清楚该如何做.这是我尝试不同解决方案时的基本结构,但这是行不通的,我的结果总是空白,因为我认为我没有正确调用变量:

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)")

如果我可以在VBS中很好地做到这一点,如果我可以在Javascript中做到这一点,那太好了,但是我不确定从哪里开始,希望能得到一些帮助.

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.

推荐答案

您有一些选择,

或者,您将这些值放在第一页的html表单中,然后将其发布到第二页,然后是 request.form 值;

或者您调用第二页并通过调用者名称(例如 page2.asp?varname = varvalue )传递值,然后您 request.querystring >这些值在第二页上;

或者您使用会话变量.例如: session("varname")= varvalue ,然后通过 session("varname")方式将其显示在第二页上.例如:response.write(session("varname")).

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.

这篇关于使用上一个ASP页面中的变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆