How to store data if checkbox is selected
<p>I'm doing this one using PHP.</p>

<p>I'm doing some basic quiz application and it has a backend. On my backend, I am setting up a quiz for students to answer. One of my interface is like this.</p>

<p><img src="http://i.stack.imgur.com/ELwTk.png" alt="enter image description here"></p>

<p>If the user checked the box, it means 1950 is the answer. How would I process that one in my database to determine that 1950 has been the answer of the question.</p>

<p>My Database is like this.</p>

<pre><code>tbl_choices
Id,Choice,isAnswer
</code></pre>

<p>so ideally, it would be stored like this.</p>

<pre><code>tbl_choices
ID         CHOICE      isAnswer
001         1900          0
002         1800          0
003         1950          1
004         1850          0
</code></pre>

<p>My question here is how would I code it in a sense when a user will check the checkbox and the textinput right beside it will have a value of <code>isAnswer</code> as <code>1</code>.</p>

<p>Just an additional info: When a user will click that <code>+</code> button it will add a new textinput and if user will click <code>-</code> button it will delete a textinput, but I got that all covered.</p>

<p>The choices are dynamic, it will changed, that above that I've shown you is just an example.</p>

<p><em>P.S: Sorry for the title, I don't know what's the title of this kind of question :-)</em></p>

<p>Your help would be greatly appreciated and rewarded!</p>
