<?php $data = <<<DATA [ { "name": "counting animals", "template": "counting", "data": "Images/5cats.jpg", "choices": [ 2, 5, 6, 8 ], "correctAnswer": 1 } ] DATA; $json_var = json_decode($data, true); foreach ($json_var as $value) { if ($value["name"] === "counting animals") { printf('<img src="' . $value["data"] . '" />'); printf("<form id=\"form1\">"); foreach ($value["choices"] as $val) { printf("<input name=\"image-pick\" value=$val type=\"radio\" id=\"one-$val\" >" ); printf("<label></label>"); } printf("</form>"); } }
You have javascript disabled. You will not be able to edit any code.