[thelist] Strange checkbox issue (PHP / Forms)

Lee Kowalkowski lee.kowalkowski at googlemail.com
Wed Mar 4 08:25:49 CST 2009


2009/3/4 Jack Timmons <jorachim at gmail.com>:
>> > Using the brackets makes PHP store those fields in an array.
>>
>> Yuck, OK.  The only other thing I can see is:
>>
> OT, but still helpful:
>
> Using brackets can be extremely helpful, just like in this case of
> organizing and grouping information together.

I appreciate that, but it looks like PHP is the only language that
requires you to have the square brackets in your HTML, using other
languages that's not necessary, just give the fields the same name and
you'll get an array.  That's the part which is not so nice.

Referencing such fields in client-side validation is also not as nice
(e.g. myForm['myCheckbox[]'][i] as opposed to myForm.myCheckbox[i]).

-- 
Lee



More information about the thelist mailing list