Skip to main content
Known Participant
June 27, 2008
Question

Getting values

  • June 27, 2008
  • 2 replies
  • 275 views
I have form.mydata coming to my action page with comma delimeter value:
adam,joe,ben,steve,jill,andy,david

I want to seperate them and it works inside this loop:


<cfset myd = "">
<cfloop list="form.mydata" index="i" delimiters=",">
<cfoutput>
<cfset myd = "#i#">
#myd#<br />
</cfoutput>
</cfloop>


How do I get them to print outside of loop?
This didnt work because it only printed the first value only and not all of them:


<cfset myd = "">
<cfloop list="form.mydata" index="i" delimiters=",">
<cfoutput>
<cfset myd = "#i#">
</cfoutput>
</cfloop>
<cfoutput>
#myd#<br />
</cfoutput>
    This topic has been closed for replies.

    2 replies

    Inspiring
    July 3, 2008
    Use concatenation (&) as attached.
    Inspiring
    June 27, 2008
    Florida wrote:
    > I have form.mydata coming to my action page with comma delimeter value:
    > adam,joe,ben,steve
    >
    > I want to seperate them and it works inside this loop:
    > <cfloop list="form.mydata" index="i" delimiters=",">
    > <cfoutput>
    > #i#<br />
    > </cfoutput>
    > </cfloop>

    >
    > How do I get them to print outside of loop?

    not sure what you mean by this but if you simply ant to see the form values just
    output:

    #form.mydata#

    which should show you "adam,joe,ben,steve".

    is that what you mean?