Coming from a form page, I have the following value: test1, test2, test3 .. test50.
To display 1 of them, I can do this
<output> #form.test1# </output>
But I want to display all of them using a loop, how would I do it?
<cfloop index="i" from="1" to="#form.build_found#" >
<output> #form.testi# </output>
</cfloop>
CodePudding user response:
That should work:
<cfoutput>
<cfloop index="i" from="1" to="#form.build_found#" >
#form["test" & i ]#
</cfloop>
</cfoutput>
A few cfml coders might tend to use the evaluate()
function. Don't use it, because it opens security holes in code like that.