Answered
Problem with Session variables
On page 1 I am setting a session variable based on a users
log in:
<cfif NOT IsDefined("SESSION.EmpNo")>
<cfset SESSION.EmpNo = #Form.HREmpNo#>
</cfif>
On page 2, I call the session variable into a query to pre-fill a form, this works fine:
<cfquery name="qEmpInfo" datasource="SelfNom">
SELECT *
FROM tblEmployeeList
WHERE EmployeeNo = #session.EmpNo#
</cfquery>
On the same page, I give the prefilled info hidden tags so I can enter the infor into a table on the following page. qEmpInfo is the query I am hitting successfully with my session variable. Here are my tags:
<cfoutput>#qEmpInfo.EmployeeNo#</cfoutput>
<input type="hidden" name="EmployeeNo" value="#qEmpInfo.EmployeeNo#" />
On the 3rd page, where I try to insert the infor into another table, I am getting an error. Itacts like my session variable is gone.
Error:
Syntax error in date in query expression '#qEmpInfo.EmployeeNo#'.
I entered this code on page 3 to check and it by passes it I assume because it does not find the session variable:
<cfif NOT IsDefined("SESSION.EmpNo")>
<cfoutput>#session.EmployeeNo#</cfoutput>
</cfif>
I set my session time out in the admin to 24 hours, so that should not be the issue. And I have turned on session variables in the Application.cfm:
<cfapplication name="SelfNom"
sessionmanagement="Yes">
Does anyone see something I am doing wrong?
<cfif NOT IsDefined("SESSION.EmpNo")>
<cfset SESSION.EmpNo = #Form.HREmpNo#>
</cfif>
On page 2, I call the session variable into a query to pre-fill a form, this works fine:
<cfquery name="qEmpInfo" datasource="SelfNom">
SELECT *
FROM tblEmployeeList
WHERE EmployeeNo = #session.EmpNo#
</cfquery>
On the same page, I give the prefilled info hidden tags so I can enter the infor into a table on the following page. qEmpInfo is the query I am hitting successfully with my session variable. Here are my tags:
<cfoutput>#qEmpInfo.EmployeeNo#</cfoutput>
<input type="hidden" name="EmployeeNo" value="#qEmpInfo.EmployeeNo#" />
On the 3rd page, where I try to insert the infor into another table, I am getting an error. Itacts like my session variable is gone.
Error:
Syntax error in date in query expression '#qEmpInfo.EmployeeNo#'.
I entered this code on page 3 to check and it by passes it I assume because it does not find the session variable:
<cfif NOT IsDefined("SESSION.EmpNo")>
<cfoutput>#session.EmployeeNo#</cfoutput>
</cfif>
I set my session time out in the admin to 24 hours, so that should not be the issue. And I have turned on session variables in the Application.cfm:
<cfapplication name="SelfNom"
sessionmanagement="Yes">
Does anyone see something I am doing wrong?
