[thelist] Strange checkbox issue (PHP / Forms)

Jack Timmons jorachim at gmail.com
Wed Mar 4 08:51:22 CST 2009


On Wed, Mar 4, 2009 at 8:37 AM, ben morrison <morrison.ben at gmail.com> wrote:

> I was talking about debugging sorry, as in
>
> error_log(print_r($_POST['subsection'], true);
>
> To make sure the beginning of the script is working,
>

Ah, that's a different story, then.


> Would that help to fix the problem of invalid in the loop of
> $_POST['subsection'])
>
> Surely thats where the test should be for the invalid issue.
>
> Ben
>

That was in place of your "false == empty" statement. Which, if you're
testing for false, always use ===. It's a good habit to have, because you
don't want to wonder why your script isn't working when something is
returning a 0.

For those who may not know why ===, that ensures that not only do the values
match, but the type matches also. 0 tests positive against false using ==,
but negative using === because 0 is an integer and false is boolean.

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



More information about the thelist mailing list