Welcome Guest, Not a member yet? Register   Sign In
retain state with radio buttons and checkboxes
#1

I looked everywhere in the forums and can't find an answer to how I would retain the value of a radio button, or a checkbox using set_radio() or set_checkbox() after a form is submitted. I also tried all sorts of ways of inserting set_radio() and set_checkbox(). What syntax should I use in the code below?

Example:
PHP Code:
<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 --> 
Reply


Messages In This Thread
retain state with radio buttons and checkboxes - by webmachine - 11-21-2015, 10:41 AM



Theme © iAndrew 2016 - Forum software by © MyBB