[eluser]barrysampson[/eluser]
Hi,
I'm steadily plodding on with my first CI project, and have hit another little problem that has me stumped.
User are asked to complete a form which has 30 questions, for which they have to select one of four answers. I have this working just fine, and I'm using serialize() to store the data in the db. I can get the data back out in the right format using unserialize() but I can't work out how to repopulate the edit form using the values I've pulled from the db.
I won't post the whole form here, but here's the code I'm using in my
submit form to record the answer to 1 of the 30 questions.
I'm using a copy of that form to create my
edit form but I'm not sure what I need to do to set the radio button values using the the values from the db.
Code:
<tr align="center">
<td> </td>
<td>
<?php
$selection = array(
'name' => 'a1',
'id' => 'a1',
'value' => 0, //None
'checked' => FALSE
);
echo form_radio($selection) ."</p>";
?>
</td>
<td>
<?php
$selection = array(
'name' => 'a1',
'id' => 'a1',
'value' => 1, //Basic
'checked' => FALSE
);
echo form_radio($selection) ."</p>";
?>
</td>
<td>
<?php
$selection = array(
'name' => 'a1',
'id' => 'a1',
'value' => 2, //Intermediate
'checked' => FALSE
);
echo form_radio($selection) ."</p>";
?>
</td>
<td>
<?php
$selection = array(
'name' => 'a1',
'id' => 'a1',
'value' => 3, //Advanced
'checked' => FALSE
);
echo form_radio($selection) ."</p>";
?>
</td>
</tr>
Thanks for any help you can offer.