samedi 21 mars 2015

PHP - $_POST['variable'] echos correctly but returns false in if statement

I have a htm file that passes a variable called $team to a php file. The php file echo's 'Fred' just fine on line 3 if that is what the user inputs but an if statement which asks if $_POST["team"] == "Fred" always returns negative. Can anyone help?



<?php

echo $_POST["team"] , "<br />";

if ($_POST["team"] == "Fred"){
echo "You go for " , $_POST["team"];
}

else {
echo "You do NOT go for Fred";
}

?>


Output:


Fred


You do NOT go for Fred


Aucun commentaire:

Enregistrer un commentaire