samedi 14 septembre 2019

php if else program, using first "if" statement and ignoring the rest

Im trying to get a php program that will ask for a name and age and give an output

I got the name and age but the else if section is not working it only goes to the "if" the rest get ignored even if i change the age appropriately.

their is no visible error given by the program, it runs just not as intended

echo 'your name is: '.$_GET["name"].'<br>';
echo "<br>";
echo 'your age is: '.$_GET["age"].'<br>';

if(isset($_Get["age"]) <=20)
{
echo "you are under the drinking age<br>";
}



elseif(isset($_Get["age"]) >=21 OR isset($_Get["age"]) <=35)
{
echo "you are a young man";
}

elseif(isset($_Get["age"]) >=36 OR isset($_Get["age"]) <=60)
{
echo "you are a middle aged man";
} 

elseif(isset($_Get["age"]) >=61 OR isset($_Get["age"]) <=100)
{
echo "you are asenior citizen";
} 

elseif(isset($_Get["age"]) >=100 )
{
echo "WOW your really old!!";
}

output: your name is: adam

your age is: 42 you are under the drinking age

Aucun commentaire:

Enregistrer un commentaire