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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

passing variables to forms

Status
Not open for further replies.

tmcneil

Technical User
Nov 17, 2000
294
US
I seem to have forgotten how to pass variables to multiple pages. I have an asp page that I choose values from select boxes. Those values get passed to another page by using the request.form call to each element. I want to pass these same values onto a 3rd page and am having trouble doing this. I was thinking of passing the variables through the url and use querystring to get them. Is there an easier way to do all this?

Thanks,
Todd
 
You could put them into session variables on the receiving page. Not sure if there is a better way than this, it's how I tend to pass data around. Or populate the varibales into a DB for quick retrieval, but that would be more effort probably!
 
Well, I've got the following code to use the Session variables.

Code:
 If Not IsEmpty(Request.Form("FA")) then Session("rVal") = Request.Form("FA")
  'Response.Write(Session("rVal") & "<br>")
      
  if rVal = ST then
      if Not IsEmpty(Request.Form("FASTV")) then Session("sState") = Request.Form("FASTV")
      'Response.Write(Session("sState"))
  elseif rVal = CBSA then
      if Not IsEmpty(Request.Form("FACBSAV")) then Session("sCBSA") = Request.Form("FACBSAV")
      'Response.Write(Session("sCBSA"))
  else
      if Not IsEmpty(Request.Form("FACOUNTYV")) then Session("sCounty") = Request.Form("FACOUNTYV")
      'Response.Write(Session("sCounty"))
  end if

rVal is ok but the only other variable I get is sState no matter if sCounty or sCBSA has anything in it. rVal is based on what is selected so I should only have an rVal and one other value from sState, SCBSA or sCounty. So, am I doing something wrong?
 
Try to put the value inside the quotes:

if rVal = "ST" then
...
elseif rVal = "CBSA" then



 
as tmcniel suggested use session variables, i prefer cookies, that way you can keep the environment for the end user when they return, or if they manually open a seperate window process, in which session values wont cross over

[thumbsup2]DreX
aKa - Robert
if all else fails, light it on fire and do the happy dance!
" I always think outside the 'box', because I'm never inside the 'loop' " - DreX 2005
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top