Welcome Guest, Not a member yet? Register   Sign In
Ci 3 $_POST not accepting spaces?
#5

(This post was last modified: 02-06-2020, 11:13 AM by jreklund.)

Personally I have never tried making an options array like that. I always put my value in value="" that I want to be added to the options array.

PHP Code:
<?php if( !empty($groups['department']) ): ?>
<div class="form-group">
    <?php echo form_label(lang('groups_type_department'),'documents_department[]'); ?>
    <p class="help-block"><?php echo nl2br(lang('documents_department_help')); ?></p>
    <?php foreach($groups['department'] as $group_id => $group_name): ?>
    <div class="checkbox">
        <label>
            <?php echo form_checkbox('documents_department[]'$group_idset_checkbox('documents_department[]'$group_idin_array($group_id$groups_checked))) . $group_name?>
        </label>
    </div>
    <?php endforeach; ?>
</div>
<?php endif; ?>

And grabbing it like this, to retrieve the actual value.
PHP Code:
public function _get_documents_department()
{
    return 
$this->input->post('documents_department') ? $this->input->post('documents_department') : array();


In case I want to have the name and ID i put value="key_value", and make an explode('_', $array); on the other end. If I for some reason don't want to use multiple names for different settings.
Reply


Messages In This Thread
Ci 3 $_POST not accepting spaces? - by sanderv - 02-05-2020, 03:17 AM
RE: Ci 3 $_POST not accepting spaces? - by jreklund - 02-06-2020, 11:10 AM



Theme © iAndrew 2016 - Forum software by © MyBB