我一直在尝试学习 php 并练习,我根据姓氏制作了一系列 Family Guy 字符。然后我尝试在表格中提出一个问题,我希望代码检查数组以查看它是否与数组中的正确答案匹配。我对 PHP 还是很陌生,这真的只是一个学习经验。代码看起来像这样......
<?php
$families = array(
"Griffin" => array(
"Peter",
"Louis",
"Chris",
"Stewie",
"Meg"
),
"Quagmire" => array(
"Glen"
),
"Brown" => array(
"Cleveland",
"Loretta",
"Junior"
)
);
?>
<html>
<head>
</head>
<body>
Which of these Family Guy Characters is part of the Griffin family?
<form action = "familyguyquestions.php" method = 'post'>
A: <input type = "radio" name = "cleveland">Cleveland
B: <input type = "radio" name = "glenn">Glenn
C: <input type = "radio" name = "meg">Meg
D: <input type = "radio" name = "quagmire">Quagmire
<input type = "submit" name = "submitQuestion">
</form>
</body>
</html>