Hi,

(I think you intended to send this to the list...)

On Thu, 13 Nov 2003 02:03:50 -0500
"Jake McHenry" <[EMAIL PROTECTED]> wrote:

...[snip]...

> I'm running RHLinux 9, php 4.2.2, apache 2.0.40

Hmm... same here. Only difference could be that I rebuilt the
php RPMs to support mbstring--I'm sure it's not related
though ;)

> if (($_POST['accid_1']) && ($_POST['accid_2']) &&
> ($_POST['accid_3'])&& ($_POST['accid_4']) &&
> ($_POST['accid_5'])){
>   do my stuff... 
> }
> 
> All variables are 1 character long, and should be numbers.
> I have a preg_match inside the condition.. But it wasn't
> even getting that far.

(Just a note: If they should be numbers, maybe you can use
is_numeric().)

> But when any of the values were 0, then it didn't do my
> stuff, which kinda caught my attention... lol

In the above, you're basically asking

  if (all of these are TRUE) {
    do my stuff...
  }

So, if even one of those is "0" then it won't do your
stuff...

> ***
> 
> I just seemed to fix the problem, I changed the above code
> to($_POST['accid'] != "") for each one, and it works now...
> ? Could someone please enlighten me as to what's happening
> here?

Well, this

  if ($_POST['accid'])

is asking something like

  if (TRUE)

so if the value of $_POST is "0" then it's FALSE. If the
value is "1" or "a" or "Edwin" then that would evaluate to
TRUE.

Whereas this one

  if ($_POST['accid'] != "")

is asking something like

  if the value of $_POST is not equal to "" then...

So, since "0" is not equal to "" then the result would be
TRUE. If the value "1" or "a" or "Edwin" then that would
STILL evaluate to TRUE since those are not equal to "".

Not sure if I had explained this well since I'm starting to
have a headache trying to figure out how to explain 'What is
"TRUE"?' "Not 'FALSE'". "Then, what is 'FALSE'?" "Not
'TRUE'." "??."

:)

- E -
__________________________________________________
Do You Yahoo!?
Yahoo! BB is Broadband by Yahoo!
http://bb.yahoo.co.jp/

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

Reply via email to