I have a survey form with 5 ques, there is one question on each page and user clicks through them with next button on the page. Now, the user is not logged in, I want to set a session variable only when the user takes the first ques on form and clicks next. But I am getting userid not defined in session for the line 2. I am not really sure what I am doing wrong here. Can anyone suggest if they see what is going on. I don't want to be creating multiple userids every time he hits next button. Thanks
<cfif structKeyExists(FORM, "user_mode") and form.user_mode EQ "next"> <cfif NOT ( StructKeyExists(session,userid) )> <cfquery name="insertuser" datasource="#application.datasource#"> INSERT INTO survey_user(ip_address) VALUES (<cfqueryparam cfsqltype="cf_sql_varchar" value="#CGI.REMOTE_ADDR#" />) </cfquery> </cfif> </cfif>