php remove button keeps retreiving posted information

Posted by Doug on Stack Overflow See other posts from Stack Overflow or by Doug
Published on 2010-01-01T14:01:32Z Indexed on 2010/03/27 23:03 UTC
Read the original article Hit count: 383

Filed under:
|
|
|
|

Hi every1! im quickly finding im quite the beginner to php, so please bare with me!

I have a quick problem, I have a remove button for a shopping cart and the code works for it everytime except for the last product thats in the cart. If a person pushes the addtoCart button the URL is reloaded with ?buyproduct=$productNumber and when the remove button is pushed the product is removed. Right so everything is good, but when you try to remove the last item, it keeps reading the product thats in the URL. so the quantity remains 1 for the current $productNumber.

i've tried adding the action in the form method tag so that the page reloads without the ?buyproduct=$productNumber, which does work however there are page numbers and sections that were also in the URL and these get reset also.

i know the remove is working because once the ?buyproduct=$productNumber is gone from the URL (which can happen for example if they go to another section in the catalog) then the cart can be completely emptied.

Thank you so much ahead of time for any1's help, I've used this site before and you guys are genius's!

© Stack Overflow or respective owner

Related posts about php

Related posts about submit