In the process of building out a shopping cart, and I'm a bit baffled by the following:
The background
I start a session on a product catalog page. The user clicks the order button, and a session multidimensional array is created, holding the product id number and setting the quantity to 1. This works great. I can refresh this page and it increments the value of the item added. This cart page also includes delete and adjust quantity functions, which also work properly.
The problem
Now, if I navigate back to my product catalog page and add another item, everything still works fine. HOWEVER, if I hit refresh on that page, and then click to add an item, the session array holding the cart contents gets dropped. Again - I can refresh to my heart's content on the cart page, but from the catalog page, this somehow clears my session array...
Any idea what could be the cause, or at least a good way to step through debugging this situation?
Much thanks.
[SOLVED] Session Array Cleared on Refresh???
Moderator: General Moderators
[SOLVED] Session Array Cleared on Refresh???
Last edited by eppievojt on Wed Jun 25, 2008 6:29 pm, edited 1 time in total.
Re: Session Array Cleared on Refresh???
Thanks to anyone who tried to figure this out. I was actually able to find the solution on my own. The problem appears to be that the testing server I'm on has register_globals turned on. As a result there was a conflict between $products and $_SESSION['products'] - changing the session variable to $_SESSION['products_array'] made everything function properly.