Hi there boatmark I really appreciate your help! I tried your examples I couldn't get any of them to work
I'll explain more clearly what I need to do.
So my for each loop echo's out all of the items in the basket displaying stuff like id, name, price and a photo. I have three items in the basket just now for testing, on the screen appears these three items as echoed in the for each loop. Now I need to store the value of the id, price and quantity of each item that was displayed on the screen. So in another php file I will add this information to an orders table. To get the information I need to retrieve it from session variables, as this seems the easiest way to pass values in variables across the application.
So inside my for each loop, I have three session variables to store the three values I need, but of course these variables only hold data from the last item in the basket, the last to be iterated. So three items means I need 9 session variables, or some other way to add this data to the orders table.
The orders table has four columns, itemID, orderID, productID, quantity, price.
So for each item in the basket they need to be added to the table, one row per item.
This has been really tricky, I don't know the best way to do this, my initial idea is seeming to be a bad one.
I am open to any suggestions.
Many thanks for any help!