Probably better to scope your references to form variables, though it might
not be absolutely necessary.

<cfloop index="i" from="1" to="#x#">
  <cfset thisskillid = "Skillid#i#">
  <cfparm name="form.level#i#" default="">
  ...
</cfloop>

Jim


----- Original Message -----
From: "Erika Foster" <[EMAIL PROTECTED]>
To: "CF-Community" <[EMAIL PROTECTED]>
Sent: Wednesday, August 08, 2001 2:58 PM
Subject: cf-talk is buggin' out and I have a brainfart.


> Can anyone help??
>
> Hi - this has got to be an easy fix.  I've got a dynamic form sending a
> dynamic amount of fields to a Query.  The form fields Level#i#  are radio
> buttons.  Here's the code:
>
> <cfloop index="i" from="1" to="#x#">
>  <cfset thisskillid = Evaluate("Skillid"&i)>
>  <cfset thislevel = Evaluate("level" & i)>
>  <cfset thisempid = #empid#>
>
>  <cfquery name="getanswer" datasource="personnel">
>   SELECT empid, skillid
>   FROM tblMatrix
>   WHERE empid=#thisempid# and skillid=#thisskillid#
>  </cfquery>
>  <cfif #getanswer.recordcount# is 0>
>  <cfquery name="insertrow" datasource="personnel">
>   INSERT INTO tblMatrix (empid, skillid, skilllevel) VALUES (#empid#,
> #thisskillid#, #thislevel#)
>  </cfquery>
>  <cfelse>
>  <cfquery name="updaterow" datasource="personnel">
>   UPDATE tblMatrix
>    SET skilllevel=#thislevel#
>    WHERE empid=#thisempid# AND skillid=#thisskillid#
>  </cfquery>
>  </cfif>
> </cfloop>
>
> The problem is that if the the user doesn't answer that particular
question,
> say they don't answer the first question - then this is the error:
>
> An error occurred while evaluating the expression:
>
>
>  thislevel = Evaluate("level" & i)



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to