bcarl314
07-20-2002, 05:00 AM
All right, I can't figure out the best way to do this.
I want to create a shopping cart on my site which will allow users to add multiple items to their cart. Sounds easy enough. I've done it client side, but now am "expanding my horizons" with server side.
What I would like to do is register a session array named items, which will contain the SKUs of the product ordered.
So every time someone "adds" an item to their cart it pushes this array and maintains the data throughout the session. Only problem is I can't get that to work.
I've tried the following:
session_start();
session_register('items[]');
array_push($items,$sku);
but I get an items not defined error.
Is this how you would go about it? Is there a better way? Why doesn't the method above work?
I want to create a shopping cart on my site which will allow users to add multiple items to their cart. Sounds easy enough. I've done it client side, but now am "expanding my horizons" with server side.
What I would like to do is register a session array named items, which will contain the SKUs of the product ordered.
So every time someone "adds" an item to their cart it pushes this array and maintains the data throughout the session. Only problem is I can't get that to work.
I've tried the following:
session_start();
session_register('items[]');
array_push($items,$sku);
but I get an items not defined error.
Is this how you would go about it? Is there a better way? Why doesn't the method above work?