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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update Array 1

Status
Not open for further replies.

anastasia

Programmer
Dec 13, 2000
111
GB
Hi, I am trying to update an Array a quantity field. What happens is the user selects products and then views these in a table in the checkout beside each product is an update button. Each product has one which is generated in a loop. At the moment the user selects this button which takes them to another page the update.cfm page where the user can change the quantity. However what I am trying to do in the checkout page is increment the aray index by 1 rom the beginning of the Array to the end of the Array in a loop so that each update button incremented has an index value from 1 onwards etc. The code I have to start with is shown below:

When the user passes their mouse over the update button the index value is shown to be passed to the update page in the example below I have just typed this in so the index value for each button will always be 1 this has to change to 2 and so on. I know I have to do a loop in which the index is incremented by 1 on each turn of the loop, but I am not sure of the syntax? Any ideas. I do have a loop already created that loops through to display the products to the user and that creates these buttons the loop is

<cfloop index=&quot;rowCount&quot; from=&quot;1&quot; to=&quot;#ArrayLen(session.basket)#&quot; step=&quot;1&quot;>

<A
href=&quot;update.cfm?index=1&quot;
target=mainFrame><IMG border=0 height=28 name=Image13
src=&quot;checkout_files/prod_update.gif&quot; width=67></A> </TD>

</TR></TBODY></TABLE>


 
Do you mean you are trying to increment the update.cfm?index=1 on each line? If so, why not say update.cfm?index=#variables.rowCount#? rowCount is always going to be a consistent reference to the correct element in your array. Andrew
 
Thank you AMayer for your reply. Yes your reply above does work with index set to RowCount implemented within a array loop. Thank you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top