Greetings Everyone:
On my current project I have to to create an ordering system for a sandwich store that delivers.
Here is my task: Show the order menu and select the items that should be added to the "Order Basket". No e-commerce will be done over the web, just put the final order in a database table when they click "Send Order".
The input tag below shows the checkbox form element I have next to each item that can be ordered.
"categoryIDXXsandwichIDXXColumnNameOfItemPrice",
or literally "<input type=checkbox name=orderItems[] value=1XX13XXcombo12Price>"
I want to keep an ongoing record (array variable) for each item that is in the Order Basket, so I want to register the variable then persist it through the whole session, but here are a few issues I can't figure out.
1) How do I register an array variable? (assuming this is the right approach)
2) How do I keep adding to that array variable?
Each time the user clicks the "Add to Order" button, the form submits and shows the "Order Basket" just fine, but if I go back and add more, it only shows what I had just added, not what I previously added.
What is the trick?
If my form variable is orderItems[], then should I register "orderItems[]"? or "orderItems"?
If I register orderItems[], and use teh same name for my form variable, will my form variables automatically be added to registered variable?
I have never done a shopping cart (obviously), so I am confused on what the trick is here?
I know I could just insert everything into the database but I wanted to learn how to use sessions for this.