On Tuesday, June 25, 2002, at 04:28  PM, Vicki wrote:

> 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.

Before we even discuss the logic of your code, I need you to confirm 
that you are

1) properly quoting your attributes (some browsers will react badly if 
you don't)
2) not using the actual value "checkbox[$artID]" in your code

With "2", in other words I am making sure you are not trying to pass an 
array element name via HTTP.  The name of any HTML form input needs to 
be made up of letters, underscores, and numbers, IIRC.

As far as the logic goes, forgive me for being blunt but your 
explanation is confusing me and I can't really follow it.  If you have 
neat, commented code, post the relevant part of it and hopefully someone 
can come up with some good input (I'll take a stab).

Basically checkboxes are tricky, because if a checkbox is NOT checked, 
and then the form is submitted, an empty variable name is NOT sent... 
only checked boxes are sent.  So you need to check for the presence of 
variables if you are going to unset() the unchecked boxes, or determine 
the unchecked values based on what is NOT checked, etc.

Good luck



Erik Price
Web Developer Temp
Media Lab, H.H. Brown

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to