Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Session Variable

New Here ,
May 01, 2006 May 01, 2006
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
TOPICS
Server side applications
266
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 05, 2006 May 05, 2006
LATEST
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 😉
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines