You need to loop over an array and output all the values.
There are two different ways to loop over arrays in ColdFusion. Using an index loop and accessing the elements of the array by the specified index and specifying the array itself and outputting the specific element in the array.
Using an index loop:
Looping over the array using an index loop. ColdFusion arrays start their index at 1 unlike other languages where they start at 0, thus it'spossible to loop from 1 to the length of the array.
<!--- create the array ---> <cfset family = [ "Thadeus", "Hank", "Dean", "Brock" ] /> <cfoutput> <ul> <cfloop from="1" to="#ArrayLen( family )#" index="i"> <li>#family[i]#</li> </cfloop> </ul> </cfoutput>
Using an array loop:
When using an array loop, the array is specified and the index contains the value in the array at the current position in the loop.
<!--- create the array ---> <cfset family = [ "Thadeus", "Hank", "Dean", "Brock" ] /> <cfoutput> <ul> <cfloop array="#family#" index="i"> <li>#i#</li> </cfloop> </ul> </cfoutput>
+