Old Lady wrote:[color=blue]
> I am trying to understand
> why this problem is just with checkboxes and not with text or select
> fields. Any idea? It's a HTML bug or what?[/color]
By design (HTML) only form controls with data get sent to the server.
So, if you have
[X] check 1
[ ] check 2
[X] check 3
Only "check 1" and "check 3" will be sent to the server.
When the control names are equal and include "[]" php converts them to
an array.
The browser sends something like "flg[]; flg[]" and php converts
to flg[0] and flg[1].
If you include the indexes in the control name, the browser will send
"flg[0]; flg[2]" which will be interpreted literally by php.
And that means that if you do
<?php
for ($i=0; $i<3; ++$i) {
if ($_POST['flg'][$i]) /* something */;
}
you will get a notice about an undefined index for $_POST['flg'][1].
[color=blue][color=green]
>>BTW: Don't you want to turn register_globals off? :-)[/color]
>
> Yep... But the code is VERY old and I have to change a lot of rows in
> a suite applications used by 2,500 users. I'm starting fixing the code
> for the register_globals, but this will take A LOT of time, to fix and
> to check for any new errors...[/color]
I don't envy you :-)
Good luck!
--
Mail to my "From:" address is readable by all at
http://www.dodgeit.com/
== ** ## !! ------------------------------------------------ !! ## ** ==
TEXT-ONLY mail to the whole "Reply-To:" address ("My Name" <my@address>)
may bypass my spam filter. If it does, I may reply from another address!