passing variables between asp and vbscript codes

  cyberpharmacist 17:09 05 Oct 2003
Locked

Hi All,

I am trying to pass some values between asp codes in % %> and script language=vbscript> /script>.

This is because there is this vb script function which I need to use for OWC (office web component) and I need to pass some variables from the database (retrieved from the database) to the function, but even calling the function is from the listbox_onchange, so I am not sure how i can do that. but knowing how to pass the variable will be a good start i think.

many thanks.

  Taran 17:40 05 Oct 2003

You can transfer variables in a number of ways and for a range of purposes.

On a form:

<FORM METHOD=POST ACTION="page.asp">

<INPUT TYPE="text" NAME="var1">

<INPUT TYPE="text" NAME="var2">

</FORM>

Retrieving data through a form can be done by using METHOD=POST, like this:

Request.Form("var1")

and

Request.Form("var2")

You can use:

Request.QueryString("var1") etc for METHOD=GET.

---------------------

Request("var1")

and

Request("var2")

works for GET and POST.

---------------------

Let's say you have a test file (page.asp)

To send in the URL:

page.asp?var1=test&var2=page2

This assumes that var1 and var2 are your variables: obviously you have to use a question mark (?) after the URL filename and more than one variable is separated by an ampersand (&) in the URL.

---------------------

Retrieving data requires something along the lines of the following:

Request.QueryString("var1")

and

Request.QueryString("var2")

At this point I should mention that you still need to include the full http :// w w w. and so on of the web page address.

---------------------

Session variables are another possibility:

page1.asp:

<%

session("var1") = "X"

session("var2") = "Y"

%>

page2.asp:

<%

var1 = session("var1")

var2 = session("var2")

%>

This is particularly useful where the variables will be used on multiple pages instead of an explicit pass.

---------------------

You've opened up a huge can of worms and there is no easy answer.

One point: it can be simpler all round to pass variables using ASP with Javascript instead of using VBScript.

Search for tutorials online and you will find loads of free information on this and similar processes.

Without knowing exactly what it is you want to do and why, it is impossible to be anything other than very general with an answer.

Regards

Taran

This thread is now locked and can not be replied to.

Elsewhere on IDG sites

Galaxy Note 8 vs iPhone X

This is what design agencies will look like in 2032

How to update iOS on iPhone or iPad

WhatsApp : comment lire vos messages sans que l’expéditeur le sache