Re: [PHP] if statement with or comparison (newbie)
I think the OR should be an AND ...
If $_REQUEST['id'] = "black" then the second test will be true and it
will output "wrong color." If the color is "white" then the same thing
will happen 'cause it meets the first criteria.
-- Mitch
Kevin Murphy wrote:
> Shouldn't that be this instead:
>
>
> if (($_REQUEST['id'] != "black") OR ($_REQUEST['id'] != "white")) {
>
> echo "wrong color";
>
> } else {
>
> echo "right color";
>
> }
>
>
|