Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / ColdFusion / Advanced Techniques / December 2005



Tip: Looking for answers? Try searching our database.

Passing Form variable issue

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
cory@vimm.com - 30 Dec 2005 02:30 GMT
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]#
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.