asafadis Posted June 4, 2008 Share Posted June 4, 2008 Background Info: I've created a custom shopping cart in PHP. This cart will allow you to add, update, and remove items from itself. Every item is an object and they are stored in the 'cart' object. The cart is stored in the session (which is created as soon as user logs in). Problem: The cart works perfectly in all the popular browsers except for IE6. I am able to add items to the cart just fine; however they cannot be updated or removed. Actually (and this is weird), only the first item can be updated (but not removed). Questions: What's the source of the problem? How do I fix this? Note: I've already tried: header('P3P: CP=NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM'); While researching this issue, I also stumbled upon this possible solution. Unfortunately this seems to be the solution for a lack of session "maintainability" when dealing with third-party cookies. This is not my case for I am, in fact, able to hold the session. My problem is that I can't update/remove the items in the cart in the session, but I can add all the items I want. Again... only in IE. Test site: URL: http://projects.aymansafadi.net/nauticalhangups/wholesale/login USERNAME: eeguest PASSWORD: eeguest [attachment deleted by admin] Link to comment https://forums.phpfreaks.com/topic/108626-solved-items-in-shopping-cart-stored-in-session-cannot-be-updatedremoved-in-ie6/ Share on other sites More sharing options...
PFMaBiSmAd Posted June 4, 2008 Share Posted June 4, 2008 The most likely cause is a form that is not valid HTML (or html that the browser version understands) and the browser is not submitting the right data or any data at all. For the application functions that don't work, have you used the php var_dump() function to display the actual data to see what it is, including the length, in case there is some problem with it, like white-space, that would prevent comparisons from working? Posting your application code would help. Just seeing the class definition does not provide much information about what conditions the application code is expecting to perform the functions that are not working. Link to comment https://forums.phpfreaks.com/topic/108626-solved-items-in-shopping-cart-stored-in-session-cannot-be-updatedremoved-in-ie6/#findComment-557196 Share on other sites More sharing options...
asafadis Posted June 4, 2008 Author Share Posted June 4, 2008 You were right! I just learned something else about IE6 vs. the world. Every element in the form pertaining to an item was formatted something like "qty_6" or "productId_8". Except for the action buttons, which where formatted something like "updateItem" or "updateCart". My logic was identifying the "action" by finding the element without an underscore ("_"). This worked fine in Firefox and IE7 because they ignore all the buttons that where not submitted, therefore only submitting one "action" button at a time. IE6, however, submits all the buttons, whether they were clicked or not. Every time I would submit the form, every single button ("Update Item", "Remove Item", "Update Cart", "Clear Cart", "Send Order", "Print Order", etc.) was also submitted, therefore throwing off my "one action" logic. Because the first "action" button is "updateItem", that's why only the first item in the cart would get updated. Thanks for the inspiration PFMaBiSmAd! Link to comment https://forums.phpfreaks.com/topic/108626-solved-items-in-shopping-cart-stored-in-session-cannot-be-updatedremoved-in-ie6/#findComment-557353 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.