> I have a small dilemma on my hands. i was wondering if there is
> any way to
> append a variable to another variable? basically this is what i
> am trying to
> do:
>
> <cfset varMyIndex = 0>
> <cfloop condition="varMyIndex LESS THAN OR EQUAL TO 500">
> <cfset varMyIndex = "#varMyIndex#" + 1>
> <cfif '#FORM.fldName("#varMyIndex#")#' IS NOT ''>
> <cfquery name="qryInsertRecs" datasource="myDatasource">
> INSERT INTO TABLE(fldName)
> VALUES ('#FORM.fldName("#varMyIndex#")#')
> </cfquery>
> </cfif>
> </cfloop>
>
> so my output would be something like fldName1, fldName2 etc... up to 500
>
> however the page keeps giving me errors. what is the correct way to
> accomplish this?
You want to look at Evaluate()
<cfset varMyIndex = 0>
<cfloop condition="varMyIndex LESS THAN OR EQUAL TO 500">
<cfset varMyIndex = varMyIndex + 1>
<cfset s=Evaluate("FORM.fldName#varMyIndex#")>
<cfif s IS NOT ''>
<cfquery name="qryInsertRecs" datasource="myDatasource">
INSERT INTO TABLE(fldName)
VALUES ('#s#')
</cfquery>
</cfif>
</cfloop>
HTH
Philip Arnold
Director
Certified ColdFusion Developer
ASP Multimedia Limited
T: +44 (0)20 8680 1133
"Websites for the real world"
**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
**********************************************************************
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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