I am trying to display the contents of an array at the moment the array only displays the last selection that the user has selected the last product id and quantity. I want the user to be able to go back and forth slecting items and then all of the items that the user selected displayed.
Any ideas would be greatly appreciated as this is my first application I have created in Cold Fusion. Thanks
The code I am using is as follows.
This creates the array and gets the product id from the url from the previous page and puts it nto the array.
Details Page
<CFSET session.basket=ArrayNew(2)>
<CFSET session.basket[1][1]=#url.answer#>
<CFSET session.basket[ArrayLen(session.basket)+1][1]=#url.answer#>
The user then goes onto this page. The quantity is put into the array from the previous page.
The quantity if for the product id selected.
Checkout page
<CFSET session.basket[1][2]=#form.quantity#>
<CFSET session.basket[ArrayLen(session.basket)][2]=#form.quantity#>
a loop is then performed but only outputs the last id and quantity selected no others when the user oes back to select other items.
<CFLOOP index="rowCount" from="1" to=#ArrayLen(session.basket)#"step="1">
<CFOUTPUT>
#session.basket[rowCount][1]#
#session.basket[rowCount][2]#
</CFOUTPUT>
</CFLOOP>
p.s The code is fine there are no errors as regards to coding syntax.
Any ideas would be greatly appreciated as this is my first application I have created in Cold Fusion. Thanks
The code I am using is as follows.
This creates the array and gets the product id from the url from the previous page and puts it nto the array.
Details Page
<CFSET session.basket=ArrayNew(2)>
<CFSET session.basket[1][1]=#url.answer#>
<CFSET session.basket[ArrayLen(session.basket)+1][1]=#url.answer#>
The user then goes onto this page. The quantity is put into the array from the previous page.
The quantity if for the product id selected.
Checkout page
<CFSET session.basket[1][2]=#form.quantity#>
<CFSET session.basket[ArrayLen(session.basket)][2]=#form.quantity#>
a loop is then performed but only outputs the last id and quantity selected no others when the user oes back to select other items.
<CFLOOP index="rowCount" from="1" to=#ArrayLen(session.basket)#"step="1">
<CFOUTPUT>
#session.basket[rowCount][1]#
#session.basket[rowCount][2]#
</CFOUTPUT>
</CFLOOP>
p.s The code is fine there are no errors as regards to coding syntax.