I want to use JSON to store the value into Mysql cuz I am making a quiz and there are many answers. But it doesn't go well. Please tell me what's wrong.THX!
<form method="post" action="resultme.php">
<h4> Q1 </h4>
<input name="a[0][]" type="radio" value="1" /><span>Yes</span>
<input name="a[0][]" type="radio" value="2" /><span>maybe</span>
<input name="a[0][]" type="radio" value="3" /><span>No</span>
<h4> Q2 </h4>
<input name="a[1][]" type="radio" value="1" /><span>Yes</span>
<input name="a[1][]" type="radio" value="2" /><span>Maybe</span>
<input name="a[1][]" type="radio" value="3" /><span>No</span>
<h4> Q3 </h4>
<li class="ji">Language</li>
<li><input name="a[2][]" type="checkbox" value="11" /><span>English</span></li>
<li><input name="a[2][]" type="checkbox" value="12" /><span>Chiness</span></li>
<li class="ji">Sport</li>
<li><input name="a[2][]" type="checkbox" value="21" /><span>swim</span></li>
</ul>
<input type="submit" value="click" name="submit" />
How to get the POST thing? Here is my thought below to get each answer then I can json with {} But it' no use.
$ans =array( "q1"=> $_POST['a[0]'],
"q2"=> $_POST['a[1]'],
"q3"=> $_POST['a[2]'],
)
print_r json_encode( $ans );