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

how to make a variable global only to a set of asp pages????

Status
Not open for further replies.

neetu

Programmer
May 25, 2001
11
IN
1.i have a varaible say "A" which i retrive in a select box in an htm file which connects to asp file number 1
2.then i check for some condition in the asp file number 1...the conditon is based
on a sql query which redirects(by including files) to the respective asp file number 3 or asp file number 4.

i want to know how i can retain the value of the "A" in the respective asp file number 3 or 4.
i tried using hidden value type for "A" but it works only within forms & i dont hv any form here.

iam enclosing the code as below:

<%Response.Buffer=True

'Retrive form fields into variables
EmpName=Request.ServerVariables(&quot;LOGON_USER&quot;)
WkEnd=Request.Form(&quot;WkEnd&quot;)

'Create the Sql command string
MySQLP=&quot;SELECT * FROM Plannedtable WHERE Proj_Lead='&quot;&EmpName&&quot;' And WkEnd='&quot;&WkEnd&&quot;'&quot;

'Insert the form data into the Table
Set MyConn= Server.createObject(&quot;ADODB.Connection&quot;)
MyConn.open &quot;FILEDSN=C:\WINNT\ODBC\Data Sources\Report.dsn&quot;

Set RS = MyConn.Execute(MySQLP)
if NOT RS.BOF then
RS.movefirst
end if

if RS.EOF then %>
<!-- #include file=&quot;Enter.asp&quot; -->
<%else%>
<!--#include file=&quot;Enter1.asp&quot;-->
<%end if%>

pl note that the variable &quot;A&quot; here is &quot;WkEnd&quot;
 
Set it to be a session variable. It is then active until the session is closed.

Session(&quot;A&quot;) = wkEnd

The session variable can now be accessed from any asp page. Mise Le Meas,

Mighty :)
 
session varaibles is fine ...but the value for this WkEnd will remain constant only for maximum 3 asp pages & then it has to be chosen again on another link under the same sight.
and i think using session variables will create complication...
instead i was thinking if could hv WkEnd as hidden value & carry on ...but the above code is not in a form....
 
The values of session variables do not have to remain constant. you can overwrite them at any time. Mise Le Meas,

Mighty :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top