I am finding the documentation and examples that I’ve Googled about this topic confusing. I can’t figure out the proper way to use set_radio() and set_checkbox to keep the values of radio buttons and checkboxes after form submission. Here is a portion of my form:
<div class="form-control">
Client has read and understood the confidentiality guidelines.
<?php
$data = array(
'name' => 'guidelines',
'id' => 'signed_yes',
'value' => 'yes',
'style' => 'margin-left: 20px;'
);
echo form_radio($data);
?>
<?php echo form_label('Yes', 'signed_yes'); ?>
<?php
$data = array(
'name' => 'guidelines',
'id' => 'signed_no',
'value' => 'no',
'checked' => TRUE, // default value
'style' => 'margin-left: 20px;'
);
echo form_radio($data);
?>
<?php echo form_label('No', 'signed_no'); ?>
</div><!-- end of .form-control -->
<div class="form-control">
A signed confidentiality guideline is on file for this client.
<?php
$data = array(
'name' => 'guidelines_signed',
'value' => 'yes',
'style' => 'margin-left: 20px;'
);
echo form_checkbox($data));
?>
</div><!-- end of .form-control -->
How do I use set_radio() or set_checkbox() in this code? Nothing I try seems to work.