Stop the Refresh from updating my shopping cart

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!

Moderator: General Moderators

Post Reply
jshields55
Forum Newbie
Posts: 3
Joined: Wed May 14, 2003 12:21 am

Stop the Refresh from updating my shopping cart

Post by jshields55 »

Hello,

I'm new to PHP and mysql, working on my first cart with sessions. Basically on each product page there is an "add to cart" button that has a variable attached, ie ..www.cart.php?new=43445, then on the cart page a php script runs a mysql query and spits out the cart with the product information.

The problem is when I press the browser's refresh or the forward or back buttons the quantity of the item in the cart goes up by one. Hopefully this is a simple problem with an easy solution. Does anyone know how to fix this?

Should I use the php post and get functions instead of the ?=product id at the end of the URL?

Jason
User avatar
AVATAr
Forum Regular
Posts: 524
Joined: Tue Jul 16, 2002 4:19 pm
Location: Uruguay -- Montevideo
Contact:

Post by AVATAr »

post and get have the same problem.. if you reload...

so after the user add an item in the cart, the best solution is to move him to another page (Header), and with a link like: Click here to continue or something.
Post Reply