//this is the sample form ............
<form method="post" action="coldfusion_handler.cfm">
<input type="text" name="first_name_1" />
<input type="text" name="first_name_2" />
<input type="text" name="first_name_3" />
<input type="submit" value="SUBMIT" />
</form>
// this would be your coldfusion page................
<cfif IsDefined('form.submit')>
<cfloop index="x" from="1" to="3">
<!--- set a string with with the value form.first_name_ and concatenate the index of your loop
, note the form.first_name_ is the name of the input field from your form --->
<cfset form_value="form.first_name_"&x>
<!--- the coldfusion evaluate function takes a string argument and convert it into an object,
in this case the value of the form_value is a string that contain something like this "form.first_name_1",
then the Evaluate function calls that string and turns it into an object, in this case it behaves like this
#form.first_name_1#", which as you can see calls the value of the form with the name .first_name_1 --->
<cfoutput>#Evaluate(value)#</cfoutput> </cfloop>
</cfif>
well there it is. hope that helps.
No comments:
Post a Comment