Re: More on removing item from cart
| From: | Richard Baskett | Date: | Tue, 25 Jun 2002 20:35:55 +0000 |
| Subject: | Re: More on removing item from cart | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-103844@lists.php.net to get a copy of this message | ||
You could just replace $cart with $checkbox yes? Since $checkbox will have
all the new and updated variables that you need. So assign $_SESSION[cart]
= $checkbox;
It's possible that I misunderstand what you want and are trying to do, but
that's the way I would do it.. Just totally replace the session array with
your new array.
Rick
"There is no such thing as a sudden heart-attack. It takes years of
preparation." - Unknown
> From: Vicki <vsm1656@yahoo.com>
> Date: Tue, 25 Jun 2002 16:28:08 -0400
> To: php-general@lists.php.net
> Subject: [PHP] More on removing item from cart
>
> 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
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>