storing session variables and retrieving them
A few months ago i wrote a web application that uses session to store user input as they move from one page to another.It was very successful.Then i tried to retrieve the data back into the field fromt the database when the user logs back after a logout but i was unssuccessful. This is my script. All i want to knw is that is there a way to store and retrieve my session or fill my input fill with the data from the database.
I am using cf9 and mysql on a window7
<cfset numberofSteps = 5>
<!--The session.registration structure holds user's entries-->
<!--As they move through the wizard make sure it exist-->
<cfif not isdefined("session.registration")>
<!--If structures does not exist create / initialize it-->
<cfset session.registration = structNew()>
<!--Represent Current Wizard Step start at One-->
<cfset session.registration.stepNum = 1>
<!--We will collect these from user;start at One-->
<!--We will collect these from user;start at One-->
<cfset session.registration.firstname="">
<cfset session.registration.lastname ="">
<cfif isDefined("form.fname")>
<cfset session.registration.firstname=form.fname>
<cfset session.registration.lastname =form.lname>
<cfform action="action="index.cfm?StepNum=#URLEncodedFormat(session.registration.stepNum)#" method="post" preservedata="yes"" method="post" >
<cfswitch expression="#session.registration.stepNum#">
<cfcase value="1">
<cfinput name="fname" type="text" VALUE="#session.registration.firstname#" onChange="javascript:this.value=this.value.toUpperCase();" class="EGIT-txt" required="true" validateat="onSubmit" message="You must enter a First Name." />
<cfinput name="lname" type="text" VALUE="#session.registration.lastname#" class="EGIT-txt" required="true" validateat="onSubmit" message="You must enter a Last Name." onChange="javascript:this.value=this.value.toUpperCase();" />
</cfcase>
</cfform>
