On Wed, May 23, 2007 7:41 am, kvigor wrote:

>    if($value != 'Alabama' || $value!= 'AL' || $value != 'Alaska' ||

This mess will *ALWAYS* evaluate to TRUE, because the $value is ALWAYS
only one value, and thus the other 99 values are going to evaluate to
TRUE and you have || between them...

So you have:

TRUE || TRUE || TRUE || FALSE || TRUE || TRUE ... || TRUE

which is always gonna boil down to TRUE.

You wanted && instead of ||

Actually, it would be MUCH better imho to set up a couple arrays like:

$states = array('Alabama', 'Alaska', ...);
$sts = array('AL', 'AK', ...);

if (!isset($states[$value]) && !isset($sts[$value])){
  echo "Bad Dog!";
}

YMMV

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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

Reply via email to