PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I'm trying to make this cart script, that is adding products and the quantity for the product. It then saves the array in a session, and when the customer at a later point adds a new item the script checks if session is allready set. If it is it continues with that array, just adding a new product.
The problem is that if there aren't any products stored in the array it doesn't work, and if there are 1 product in it, it want add more than one.
this makes $cart a string-variable containing the string array(). $cart=array(); makes it an empty array.
Why not simply testing the existence of that entry with isset()? An empty array isis_empty() but it is set, therefor isset() will return true.
I've done some cofiguration. Have I see it, the script will now register "cart" and "current_items" if they are not set. The script will then use these session variables to add the new item. But I just get an errorsaying that "cart" and "current_items" doesn't exist.