Skip to main content
Participant
May 2, 2006
Question

Session Variable

  • May 2, 2006
  • 1 reply
  • 251 views
I am using a session variable to set a page view. I used a POST form to set the Session("mu2")=2, then the session variable opens a graphic recordset. If the recordset is not found then the page defaults to another screen using .EOF. When I launch the form the recordset works fine but when I go back to that page Session("mu2")=2 is not saved. Here is the code a I am using in VBscript.
FORM1
<input name="mu2" type="hidden" id="mu2" value="<% Session("mu2") =1 %>">
FORM2
<input name="mu1" type="hidden" id="mu1" value="<% Session.Contents.Remove("mu2") %>">
Recordset
<%
Dim rssingleprofile__varmu2
rssingleprofile__varmu2 = "0"
If (Session("mu2") <> "") Then
rssingleprofile__varmu2 = Session("mu2")
End If
%>
<%
Dim rssingleprofile
Dim rssingleprofile_numRows

Set rssingleprofile = Server.CreateObject("ADODB.Recordset")
rssingleprofile.ActiveConnection = MM_graphic_STRING
rssingleprofile.Source = "SELECT mu2 FROM m12686_graphic.singleprofile WHERE mu2='" + Replace(rssingleprofile__varmu2, "'", "''") + "'"
rssingleprofile.CursorType = 0
rssingleprofile.CursorLocation = 2
rssingleprofile.LockType = 1
rssingleprofile.Open()

rssingleprofile_numRows = 0
%>

Thanks
Todd
This topic has been closed for replies.

1 reply

Inspiring
May 5, 2006
In order to set a session variable from a form on a page enter this at the top:

<% session("session_name") = request.form("field_name") %>

Hope this helps ;-)