Link to home
Start Free TrialLog in
Avatar of mgtm3
mgtm3Flag for Israel

asked on

what is wrong with this statment in php?

$type="gif";
if(($type!="gif") || ($type!="jpeg") || ($type=="gif"))
{
echo "You can only upload a photo";
}

and when i run it i get
You can only upload a photo
why?
ASKER CERTIFIED SOLUTION
Avatar of Cornelia Yoder
Cornelia Yoder
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
$type!="gif" or ($type=="gif")
is allways true, remove ($type=="gif") or replace it with
($type!="png")
Avatar of mgtm3

ASKER

thanks
Avatar of hielo
You need an AND condition and don't need the $type=="gif"


$type="gif";
if(($type!="gif")&& ($type!="jpeg") )
{
echo "You can only upload a photo";
}