> I'm trying to set 52 variables to the same value.  I'm not
> familiar with how loops work, but here's what I've tried
> and hasn't worked:
>
> <cfloop index="i" from="1" to="52">
>  <cfoutput>
>  <cfset person#i# = form.person>
>  </cfoutput>
> </cfloop>
>
> Result:
>
> Just in time compilation error

Your CFSET won't work, as written. What you're trying to do is to create
variables dynamically. You can do that like this:

<CFSET "Person#i#" = Form.Person>

or by using the SetVariable function:

<CFSET rs = SetVariable("Person" & i, Form.Person)>

Here, the variable "rs" is simply a placeholder, so that you can have an
assignment statement. As has been pointed out before, you could even leave
this off:

<CFSET SetVariable("Person" & i, Form.Person)>

Of the three, I'd recommend the second example, as it's explicitly supported
within CFML; the first one works, but it may not work in future versions.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444

------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to