Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

passing variable from page to page 1

Status
Not open for further replies.

clientuser

Programmer
Apr 18, 2001
296
US
how do you pass a string variable from one .asp page to another?

any examples would be greatly appreciated
 
You can do this either with the QueryString Collection or the Form collection

QueryString Method
Code:
<A HREF="page2.asp?var1=fred&var2=wilma">Page 2</A>
and page2.asp would look like this...
Code:
<%
Dim variable1, variable2

variable1 = Request.QueryString("var1")
variable2 = Request.QueryString("var2")
%>

Form Method
Code:
<FORM ACTION="page2.asp" METHOD="POST">
<INPUT TYPE="HIDDEN" NAME="var1" VALUE="some text here"></INPUT>
<INPUT TYPE="SUBMIT" VALUE="Click to go to Page 2"></INPUT>
</FORM>
and Page2.asp would look like...
Code:
<%
Dim variable1

variable1 = Request.Form("var1")
%>

Tony
reddot.gif WIDTH=500 HEIGHT=2 VSPACE=3

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top