if ($_POST) {
$family = array("Rob", "Kirsten", "Tommy", "Ralphie");
$isKnown = false;
foreach ($family as $value) {
if ($value == $_POST['name']) {
$isKnown = true;
}
}
if ($isKnown) {
echo "Hi there ".$_POST['name']."!";
} else {
echo "I don't know you.";
}
}
<form method="post">
<p>What is your name?</p>
<p><input type="text" name="name"></p>
<p><input type="submit" value="Submit"></p>
</form>
Now isKnown = false
but in the last if statement
if ($isKnown) {
echo "Hi there ".$_POST['name']."!";
} else {
echo "I don't know you.";
}
I can't understand it... Now $isKnown = false
and it says when $isknown
is false
say the code that would saying when isknown
is true
...
I understand all code but the only thing I can't is in last if
what is the value of $isKnown
and how it got this value.
What the value of $isknown
in this if statement: true
or false
?