if statement with or comparison (newbie)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm trying to set up a simple conditional, something like this:

If my_variable is NOT equal to (black or white)
   echo "wrong color"
else
   echo "right color"

Here is what I have tried:

    if ($_REQUEST['id'] != ("black" or "white")) {

        echo "wrong color";

    } else (

        echo "right color";

    )

However, no matter what I enter, I always get response "right color".

I should add that if I change the if statement to:

    if ($_REQUEST['id'] != ("black"))

then I get "right color" when I enter "black" and "wrong color" for everything else.

Would you please point out what's the trivial thing I'm missing here...

jd

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux