|
This is supposed to display in a table what am I doing wrong? When I test it in my browser it just displays the following:
"Product Price" "#products[i]#" "#dollorformat(prices[i])#" "#prices[11]#"
<html> <head> <title>Array Assignment</title> </head> <body> <cfset products = ArrayNew(1)> <cfset ArrayAppend(products,"Eggs")> <cfset ArrayAppend(products,"Cheese")> <cfset ArrayAppend(products,"Milk")> <cfset ArrayAppend(products,"Bread")> <cfset ArrayAppend(products,"Bananas")> <cfset ArrayAppend(products,"Crackers")> <cfset ArrayAppend(products,"Cereal")> <cfset ArrayAppend(products,"Strawbaries")> <cfset ArrayAppend(products,"Yogurt")> <cfset ArrayAppend(products,"Chocolate Cake")> <cfset prices = ArrayNew(1)> <cfset ArrayAppend(prices,"$3.29")> <cfset ArrayAppend(prices,"$4.50")> <cfset ArrayAppend(prices,"$2.59")> <cfset ArrayAppend(prices,"$1.95")> <cfset ArrayAppend(prices,"$1.09")> <cfset ArrayAppend(prices,"$1.20")> <cfset ArrayAppend(prices,"$3.95")> <cfset ArrayAppend(prices,"$1.89")> <cfset ArrayAppend(prices,"$2.29")> <cfset ArrayAppend(prices,"$3.79")> <cfset ArrayAppend(prices,"The total cost is $26.54")> <cfoutput>"Product Price"</cfoutput> <table> <cfloop from="1" to="#ArrayLen(products)#" index="i"> <tr> <td> <cfoutput>"#products[i]#"</cfoutput></td> <td> <cfoutput>"#dollorformat(prices[i])#"</cfoutput></td> </tr> </cfloop> </table> <cfoutput>"#prices[11]#"</cfoutput> </body> </html>
This post has been edited by blanket: 14 Oct, 2008 - 08:10 AM
|