I am having an issue with varibale being passed from a form.
I am looping a form and the form fields are appended with the loop index:
<cfloop index="i" from="1" to="#skiloop#">
<input type="text" name="skier_First_Name_#i#" value="" size="15">
</cfloop>
OK that is fine BUT when I loop the output to display the variable I run into
this issue of trying to write a variable in a variable:
<cfloop index="i" from="1" to="#skiloop#">
<cfoutput>
#skier_First_Name_(#i#)#
</cfoutput>
</cfloop>
I understand the varibale being passed is #skier_First_Name_1# although it
could be 1 - 100 based on the amount in the loop and I need to output the
amount being loop and a different variable for each based on what they submit
in the form.
Thanks
Cory
Dan Bracuk - 30 Dec 2005 03:41 GMT
Go to google and put <cfloop collection="form"> into the text box.
Ali Soylu - 30 Dec 2005 05:34 GMT
You can use the evaluate function, for example:
<cfoutput>
<cfloop index="i" from="1" to="#skiloop#">
#Evaluate("skier_First_Name_" & i)#
</cfloop>
</cfoutput>
ALi
MikerRoo - 30 Dec 2005 05:56 GMT
Instead of:
#FORM.skier_First_Name_(#i#)#
Use:
#FORM["skier_First_Name_" & i]#