PDA

View Full Version : Session Variable Help


coachdan
09-27-2003, 04:26 PM
I am new to ASP and have never used session variables before. I am trying to save the value of a dropdown box selection to a session variable to be used on multiple pages throughout my site. I will post the code for the form page and a test page I am using below:

Form page (sending page):


<%@ Language=VBScript %>
<html>
<%

Session("varRedirectBus")=Request.Form("RedirectBus")
%>

<head>
<title></title>
</head>

<body background="\Training_Dept\WB00760_.gif">

<hr>

<hr>



<font size="6">Main Menu - Select Proper Database Menu</font></p>

<hr>

<hr>

<form ACTION="\Training_Dept\sessionTest.asp" METHOD="POST">
<u><font Size="4">

Select Yearly Menu:</font></u> <select
NAME="RedirectTo" tabindex="1" size="1">
<option Selected value=" ">--SELECT YEAR--</option>
<option value="MenuDefault02.asp">2002</option>
<option value="MenuDefault03.asp">2003</option>
<option value="MenuDefault04.asp">2004</option>
</select>



<u><font Size="4"></p>


Select Business:</font></u> <select NAME="RedirectBus" tabindex="1" size="1">
<option Selected value=" ">--SELECT BUSINESS--</option>
<option>Citi</option>
<option>Sears</option>
</select></p>




Go To Correct Year: <input type="submit" name="submit1" value="submit" tabIndex="2"> </p>


Reset Form: <input
id="reset1" type="reset" value="Reset" name="reset1" tabIndex="3"></p>


</p>
</SCRIPT><!--webbot bot="HTMLMarkup" endspan
-->

</form>
</body>
</html>




sessionTest.asp (receiving page):


<html>
<%@language="vbscript"%>
<%
response.write RedirectBus
Session("varRedirectBus")=Request.Form("RedirectBus")

%>

<head>
<title>Session Test</title>
<meta name="GENERATOR" content="Microsoft FrontPage 3.0">
</head>

<body>



The Business chosen was <%=varRedirectBus%>!</p>
</body>
</html>


Anyone that could assist would be appreciated forever. I have a close deadline (tomorrow) and a large site to make changes to. I'm sure that I'm way off on what needs to be done. My code returns only the text on the test page - no variable value. :sick:

coachdan
09-27-2003, 05:01 PM
I have that part figured out! Thanks to anyone who might have read this and started the process before I posted this.

gish
09-27-2003, 05:04 PM
ok..good to know......I just saw the post now :)