Hi, I want to create a simple to use shopping basket for my php site. At the moment i view items from a mysql table via a simple query. I want to be able to add the items to my basket, empty the basket, remove individual items and have a counter on each page which tells me the quantity. As i am very new to PHP i find most sites on this subject on the internet confusing, Please Help Gary
The simplest method, is probably to create a shopping basket array which you store in the $_SESSION. If you're products are held in a mysql table, then the shopping basket array need only probably store the product id, and the chosen quantity. That makes it very easy to add items, remove items, up the quantity if the item id is already in the array, produce a count of items, and lookup the products in the basket to display.
Sorry, but don't have the time right now but.... http://forums.digitalpoint.com/showthread.php?t=436793 This guy has just built one so have a chat with him, offer to help him out, and he'll probably share the script with you! (It's always worth searching the forum before posting as 90% of the problems posted here have all been seen before)