if (isset ($_POST['posted'])) {
if ($_POST['question1'] == "Lisbon") {
echo "You are correct, $_POST[question1] is the right answer
";
}
if ($_POST['question1'] != "Lisbon") {
echo "You are incorrect, $_POST[question1] is not. the right answer
";
}
}
?>
What is the capital of Portugal?
Porto
Lisbon
Madrid
这是整个部分,它来自PDF.但事实上,他们没有说明为什么他们在if语句中使用”作为question1但在echo语句中没有使用引号.
简而言之:为什么$_POST [‘question1’]在if语句中有”
以及为什么$_POST [question1]在echo语句中没有.它们是同一个变量.
谢谢.