More asp session variable stuff

J

Jon Spivey

Hi,
<input value = "<%=Session("Identifier")%>" type=text value=""
name="sessionid" size="9">
 
M

MD Websunlimited

Hi Ray,

<input type=text value="" name="sessionid" size="9" value="<%=session("Identifier") %> >

The above assumes that the session var does not contain HTML. If it does it should be encoded.
 
K

Kevin Spencer

You SET a Session variable thusly:

Session("VariableName") = SomeValue

You GET a Session Variable by referencing it thusly:

Session("VariableName")

You WRITE a Session Variable to a page thusly:

Response.Write Session("VariableName")

- or -

=Session("VariableName")

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
T

Thomas A. Rowe

Where are you assigning the session variable, it needs to be done prior to the user getting to this
page.

Paste you code in a reply to this post.

--
==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, WebCircle, MS KB Quick Links, etc.
==============================================
 
R

Ray

My code is as follows:
<html>

<head>
<% ' FP_ASP -- ASP Automatically generated by a FrontPage
Component. Do not Edit.
FP_LCID = 2057 %>
<meta http-equiv="Content-Language" content="en-gb">
<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<% ' FP_ASP -- ASP Automatically generated by a FrontPage
Component. Do not Edit.
FP_CharSet = "windows-1252"
FP_CodePage = 1252 %>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<title>Introduction</title>
<meta name="Microsoft Theme" content="books-theme 1011,
default">
<meta name="Microsoft Border" content="none">
</head>

<body><hr>

<!--webbot bot="DatabaseRegionStart" s-
columnnames="Identifier,First_Names,Last_Name,Address_1,Ad
dress_2,Address_3,Address_4,Address_5,PostCode,Home_Teleph
one_Number,Business_Telephone_Number,Email_Address,Joined_
Date,User_Name,User_Password,Remote_computer_name,Browser_
type,Timestamp,Terms_&amp;amp;_Conditions" s-
columntypes="3,202,202,202,202,202,202,202,202,202,202,202
,135,202,202,202,202,135,11" s-dataconnection="books" b-
tableformat="FALSE" b-menuformat="FALSE" s-
menuchoice="Identifier" s-menuvalue="Identifier" b-
tableborder="TRUE" b-tableexpand="TRUE" b-
tableheader="TRUE" b-listlabels="TRUE" b-
listseparator="TRUE" i-listformat="0" b-makeform="FALSE"
s-recordsource s-
displaycolumns="Identifier,First_Names,Last_Name,Address_1
,Address_2,Address_3,Address_4,Address_5,PostCode,Home_Tel
ephone_Number,Business_Telephone_Number,Email_Address,Join
ed_Date,User_Name,User_Password,Remote_computer_name,Brows
er_type,Timestamp,Terms_&amp;amp;_Conditions" s-criteria
s-order s-sql="SELECT * FROM tblMember where User_Name =
&amp;quot;ray&amp;quot;" b-procedure="FALSE" clientside
suggestedext="asp" s-defaultfields="" s-
norecordsfound="Login details incorrect, please re-enter"
i-maxrecords="1" i-groupsize="0" botid="1" u-
dblib="_fpclass/fpdblib.inc" u-
dbrgn1="_fpclass/fpdbrgn1.inc" u-
dbrgn2="_fpclass/fpdbrgn2.inc" tag="BODY"
preview="&lt;table border=0 width=&quot;100%
&quot;&gt;&lt;tr&gt;&lt;td
bgcolor=&quot;#FFFF00&quot;&gt;&lt;font
color=&quot;#000000&quot;&gt;This is the start of a
Database Results region. The page must be fetched from a
web server with a web browser to display correctly; the
current web is stored on your local disk or
network.&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;"
startspan b-UseDotNET="FALSE" CurrentExt sa-InputTypes b-
DataGridFormat="FALSE" b-DGridAlternate="TRUE" sa-
CritTypes b-WasTableFormat="FALSE" b-
ReplaceDatabaseRegion="FALSE" --><!--#include
file="_fpclass/fpdblib.inc"-->
<% if 0 then %>
<SCRIPT Language="JavaScript">
document.write("<div style='background: yellow; color:
black;'>The Database Results component on this page is
unable to display database content. The page must have a
filename ending in '.asp', and the web must be hosted on
a server that supports Active Server Pages.</div>");
</SCRIPT>
<% end if %>
<%
fp_sQry="SELECT * FROM tblMember where User_Name
= ""ray"""
fp_sDefault=""
fp_sNoRecords="Login details incorrect, please re-enter"
fp_sDataConn="books"
fp_iMaxRecords=1
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=False
fp_fMenuFormat=False
fp_sMenuChoice="Identifier"
fp_sMenuValue="Identifier"
fp_sColTypes="&Identifier=3&First_Names=202&Last_Name=202&
Address_1=202&Address_2=202&Address_3=202&Address_4=202&Ad
dress_5=202&PostCode=202&Home_Telephone_Number=202&Busines
s_Telephone_Number=202&Email_Address=202&Joined_Date=135&U
ser_Name=202&User_Password=202&Remote_computer_name=202&Br
owser_type=202&Timestamp=135&Terms_&_Conditions=11&"
fp_iDisplayCols=19
fp_fCustomQuery=True
BOTID=1
fp_iRegion=BOTID
%>
<!--#include file="_fpclass/fpdbrgn1.inc"-->
<!--webbot bot="DatabaseRegionStart" endspan i-
checksum="5004" --><p>Welcome&nbsp;<!--webbot
bot="DatabaseResultColumn" s-
columnnames="Identifier,First_Names,Last_Name,Address_1,Ad
dress_2,Address_3,Address_4,Address_5,PostCode,Home_Teleph
one_Number,Business_Telephone_Number,Email_Address,Joined_
Date,User_Name,User_Password,Remote_computer_name,Browser_
type,Timestamp,Terms_&amp;amp;_Conditions" s-
column="User_Name" b-tableformat="FALSE" b-
hashtml="FALSE" b-makelink="FALSE" clientside b-
MenuFormat preview="&lt;font size=&quot;-
1&quot;&gt;&amp;lt;&amp;lt;&lt;/font&gt;User_Name&lt;font
size=&quot;-1&quot;&gt;&amp;gt;&amp;gt;&lt;/font&gt;"
startspan s-
ColumnTypes="3,202,202,202,202,202,202,202,202,202,202,202
,135,202,202,202,202,135,11" --><%=FP_FieldVal
(fp_rs,"User_Name")%><!--webbot
bot="DatabaseResultColumn" endspan i-checksum="20853" --
Member number:&nbsp;<!--webbot bot="DatabaseResultColumn"
s-
columnnames="Identifier,First_Names,Last_Name,Address_1,Ad
dress_2,Address_3,Address_4,Address_5,PostCode,Home_Teleph
one_Number,Business_Telephone_Number,Email_Address,Joined_
Date,User_Name,User_Password,Remote_computer_name,Browser_
type,Timestamp,Terms_&amp;amp;_Conditions" s-
column="Identifier" b-tableformat="FALSE" b-
hashtml="FALSE" b-makelink="FALSE" clientside b-
MenuFormat preview="&lt;font size=&quot;-
1&quot;&gt;&amp;lt;&amp;lt;&lt;/font&gt;Identifier&lt;font
size=&quot;-1&quot;&gt;&amp;gt;&amp;gt;&lt;/font&gt;"
startspan --><%=FP_FieldVal(fp_rs,"Identifier")%><!--
webbot bot="DatabaseResultColumn" endspan i-
checksum="29046" --></p>
<b
<p>

<!--webbot bot="DatabaseRegionEnd" b-tableformat="FALSE"
b-menuformat="FALSE" u-dbrgn2="_fpclass/fpdbrgn2.inc" i-
groupsize="0" clientside tag="BODY" preview="&lt;table
border=0 width=&quot;100%&quot;&gt;&lt;tr&gt;&lt;td
bgcolor=&quot;#FFFF00&quot;&gt;&lt;font
color=&quot;#000000&quot;&gt;This is the end of a
Database Results
region.&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;"
startspan --><!--#include file="_fpclass/fpdbrgn2.inc"-->
<!--webbot bot="DatabaseRegionEnd" endspan i-
checksum="62730" --><b
<%Session("Identifier")=Identifier%>
<p>
<p>
<p>
<p>
<p>
<p>
<p>
<p>
Session Identifier appears here
<input type=text value="<% =Session("Identifier") %>"
name="sessionid" size="9">


</p>


</body>

-----Original Message-----
Where are you assigning the session variable, it needs
to be done prior to the user getting to this
 
T

Thomas A. Rowe

After you have opened the recordset do the following:

<%
Session("Identifier")=fp_rs("Identifier")
%>

The above will now store the Identifier in a session for later use, however on this page I wouldn't
use the session variable, I would use the value directly from the recordset to populate the form
field:

Session Identifier appears here

<input type=text value="<%=fp_rs("Identifier")%>" name="sessionid" size="9">

or

<input type=text value="<%=Session("Identifier")%>" name="sessionid" size="9">

--
==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, WebCircle, MS KB Quick Links, etc.
==============================================
 
R

Ray

Thomas
Yes, that's done it thanks very much. I understand your
point about not using it on this page, but I am just
using this as a test to get the session variable working.
That, thanks to everybody's help, is now working!

Ray
-----Original Message-----
After you have opened the recordset do the following:

<%
Session("Identifier")=fp_rs("Identifier")
%>

The above will now store the Identifier in a session for
later use, however on this page I wouldn't
use the session variable, I would use the value directly
from the recordset to populate the form
 
Top