[thelist] Strange checkbox issue (PHP / Forms)

Jack Timmons jorachim at gmail.com
Wed Mar 4 06:18:24 CST 2009


On Wed, Mar 4, 2009 at 5:59 AM, Lee Kowalkowski <
lee.kowalkowski at googlemail.com> wrote:

> I've never put square brackets in shared names, but it looks like
> loads of people do, perhaps PHP does some 'magic' so you don't have to
> include the square brackets when referring to those fields.  The
> example given in the HTML spec doesn't use square brackets
> (http://www.w3.org/TR/html401/interact/forms.html#h-17.10).
>
> --
> Lee
> --
>

Lee:

Using the brackets makes PHP store those fields in an array.

Hugh:

Since $_POST['subsection'] is not an array when it reaches your function,
and plain test cases (http://trotlc.com/sandbox/index.php) show that it
should work provided nothing else is being done to it before, I can only
assume your script is doing something to change thee values in POST before
it gets there.

If you can pastebin the full code or supply it, that will help, because as
it stands based on your assumptions (nothing's modifying it, etc) there
should be no reason why it doesn't work. Unless I'm just daffy.

-- 
-Jack Timmons
http://www.trotlc.com
Twitter: @jorachim



More information about the thelist mailing list