Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Seperate and get values

Status
Not open for further replies.

kensington45

Technical User
Jun 26, 2008
9
I have form.mydata coming to my action page with comma delimeters:
adam,joe,ben,steve,jill,andy,david

I want to seperate them and it works inside this loop:
Code:
<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:
Code:
<cfset myd = "">
<cfloop list="form.mydata" index="i" delimiters=",">
  <cfoutput>
   <cfset myd = "#i#">
 </cfoutput>
</cfloop>
 <cfoutput>
   #myd#<br />
 </cfoutput>
 
Try:
Code:
<cfloop list="form.mydata" index="i" delimiters=",">
  <cfoutput>
    #ListGetAt(form.mydata,#i#,",")#
  </cfoutput>
  <br>
</cfloop>

Lyndon

---People Remember about 10% of what you say ---They never forget how you made them feel. Covey
 
what are you using this for if for debug then just use <cfdump var="#form.myData">

but if for regular output you are going to have to do some sort of loop to get the data out of your var...

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top