Question
Can't get session variables to work
New to using session variables so hoping someone can point
out something obvious that I'm not seeing. Thanks in advance...
Have one file called testinc.cfm:
<cfif IsDefined('session.GLOBALDEF') EQ false>
<cfoutput>Global not defined</cfoutput>
<cfset session.GLOBALDEF = 1>
<cfelse>
<cfoutput>OK</cfoutput>
</cfif>
I have 2 other files, test1.cfm and test2.cfm. Test1 includes testinc.cfm and also has a link to test2.cfm.
Test2.cfm checks to see if the session variable GLOBALDEF is defined (it should be since test1.cfm included testinc.cfm): <cfif IsDefined('session.GLOBALDEF') EQ false>
My problem is that: when I run test1.cfm - it's fine. When I click on the link to test2.cfm, test2.cfm says that GLOBALDEF is not defined. I don't understand. Shouldn't the 'isdef' return true now that the session variable has been created and intialized?
Thanks
Have one file called testinc.cfm:
<cfif IsDefined('session.GLOBALDEF') EQ false>
<cfoutput>Global not defined</cfoutput>
<cfset session.GLOBALDEF = 1>
<cfelse>
<cfoutput>OK</cfoutput>
</cfif>
I have 2 other files, test1.cfm and test2.cfm. Test1 includes testinc.cfm and also has a link to test2.cfm.
Test2.cfm checks to see if the session variable GLOBALDEF is defined (it should be since test1.cfm included testinc.cfm): <cfif IsDefined('session.GLOBALDEF') EQ false>
My problem is that: when I run test1.cfm - it's fine. When I click on the link to test2.cfm, test2.cfm says that GLOBALDEF is not defined. I don't understand. Shouldn't the 'isdef' return true now that the session variable has been created and intialized?
Thanks