In Codeigniter I am trying to populate 4 checkboxes for site options in this way
<label for="noindex"><input type="checkbox" id="noindex" value="noindex" class="" />No Index</label>
<label for="nofollow"><input type="checkbox" id="nofollow" value="nofollow" class="" />No Follow</label>
.....and so on
I want to use array to populate instead of writing code for each. Here I am trying using array
<div class="form-group">
<?= form_label('Search Engine', 'check', array('class' => 'col-sm-4 control-label')); ?>
<div class="col-sm-6">
<?php
$checkboxes = array('noindex', 'nofollow', 'noarchive', 'nosnippet');
foreach($checkboxes as $check):
$data = array(
'name' => $check,
'id' => $check,
'value' => $check,
'class' => '',
);
$labels_text = array('No Index', 'No Follow', 'No Archive', 'No Snippet');
//print_r($check);
echo '<div class="checkbox">';
foreach ($labels_text as $label_text):
echo form_label(form_checkbox($data) . $label_text, $check.'-label', array('for' => $check));
endforeach;
//echo form_checkbox($data);
echo '</div>';
endforeach;
?>
</div>
</div>
Here I stuck with the labels. Where I want to display different label (of course) for each checkbox.
Can anyone help me to get different label for each?