We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

PHP Question | Forum

Topic location: Forum home » Support » General Questions
Taylor
Taylor Mar 4 '17
I am currently learning PHP in school and I am supposed to create a quiz using a multidimensional associative array and I'm having trouble. I got the array to print out all of the questions and answers. Basically the key "3" is the answer to all of the questions and I can't seem to figure out how to count how many times "3" is checked and print out the answer. Can anyone help me with this?


$quiz = array(

"What does HTML stand for?" => array( '1' => "Home Tool Markup Language", '2' => "Hyperlinks and Text Markup Language", '3' => "Hyper Text Markup Language", '4' => "Hyper Text Manipulation Language", ), "Choose the correct HTML tag for the smallest heading:" => array('2' => "<heading>", '1' => "<h1>", '4' => "<head>", '3' => "<h6>",  ), );
 foreach($quiz as $question => $answers) {  echo $question;  echo "<form>";  foreach($answers as $index => $answer) {  echo <input type='radio' name=$option>".$answer."<br/>";"; } echo "</form>";"; } ?>
The Forum post is edited by Taylor Mar 4 '17