WebDeveloperMike Posted January 25, 2012 Report Posted January 25, 2012 Hi everybody, I was able to complete the php shopping cart tutorial by Jon Lebensold with no problems, however, I do notice that after you add an item to your shopping cart - if you refresh the browser - it adds the item again. and if you refresh a 2nd, 3rd, or 4th time it keeps adding items to your shopping cart. Is there any way to stop it from adding items to your shopping cart when the page is refreshed? Here is a link to the finished shopping cart: http://www.mikespot.net/PaypalShoppingCart/html/index.php Thank in advance for help. Mike Bostone Quote
WebDeveloperMike Posted January 25, 2012 Author Report Posted January 25, 2012 I noticed that it only adds more items when the browser is refreshed right after an item is added to the cart because the browser's url text area says "...addToCart.php?id=TOMATOSOUP" so I believe its adding it because of that 'id=TOMATOSOUP' because when i click 'view cart' and the url is just "...addToCart.php" and I refresh the browser it does not add additional items to the cart. Just thought id post a little more to make it easier for help. thanks guys! Mike Quote
falkencreative Posted January 26, 2012 Report Posted January 26, 2012 That's unfortunately the way the system works. One option might be to automatically redirect to the cart page (without the id=PRODUCT section) after adding the item to the cart using the header() function. Quote
WebDeveloperMike Posted January 29, 2012 Author Report Posted January 29, 2012 Ben - thanks for the reply. How would I go about doing that? Sorry, Im still new to the game! Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.