PHP没有为测验调用数组

时间:2018-04-27 21:43:49

标签: php

我刚刚开始使用PHP设置测验但是我遇到了一个快速问题,问题是没有调用数组中指定的值。例如,它说:

与绿色相反

它说:色轮上有什么相反的东西? 而且之间和之间缺少颜色?

我有两个单独的文件,其中一个包含数组:

<?php
$array['left'] = "green";
$array['right'] = "freed";
$array['up'] = "down";
?>

另一个是实际显示测验:

<!DOCTYPE html>
<html>
<head>
<title>Final Quiz</title>
</head>
<body>
<?php
include("newquiz2.php");
 print("What is opposite of $left on the color wheel?<br>");
 print("<form action='newquiz2check.php' method='get'>\n");
 print("<input type='text' name='left'><br>\n");
 print("<input type='submit' value='Submit Answer'>");
 print("</form>\n\n\n");

?>
</body>
</html>

我尝试过添加:     $左= @ _ GET [&#34;左&#34;]; 到实际的测验页面,但它仍然返回相同的结果。任何人都可以指出我的错误或我错过的东西。

0 个答案:

没有答案