More on removing item from cart
| From: | Vicki | Date: | Tue, 25 Jun 2002 20:28:08 +0000 |
| Subject: | More on removing item from cart | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-103842@lists.php.net to get a copy of this message | ||
I posted a question about this a couple days ago. Many thanks to Dan and
Erik for your suggestions, which I've thoroughly investigated.
Unfortunately, I still have not got the problem resolved, and I've been
working on it for so long that I think my brain may be permanently
scrambled. I do, however, have a strong suspicion about where one part
of the problem may lie, and would appreciate some clarification on this
issue.
I have a shopping cart array $cart, with $artID as its key ($artID is an
integer). $cart is set as a session variable. The cart prints to the
browser with checkboxes next to each article and instructions to uncheck
the checkbox and click on the "Save Changes" button to remove items from
the cart. (This is the part that doesn't work.) The checkbox input has
"NAME = checkbox[$artID] VALUE = yes", and there is a hidden input with
"NAME = save VALUE = true" that are passed when the form is submitted.
My suspicion is that my problems are caused by the fact that I'm trying
to relate two arrays - $cart and $checkbox. They do have the same key
($artID), but I haven't been able to find any way to get them to work
together. All I want this piece of code to do is return a $cart that
doesn't include any articles ($artID) that weren't checked. I've tried
dozens of variations, but now I think most of them have been reading
from one or the other array and therefore failed.
If anybody has any suggestions on this I'd be very grateful. I've been
working on this for days (I'm very new to PHP), and it just doesn't seem
like it should be that difficult.
Thanks, Vicki