Welcome Guest, Not a member yet? Register   Sign In
Not getting the value from the on/off switch checkbox
#1

[eluser]Lykos22[/eluser]
Hi, I'd like some help please. I have this form group: This is the view:
Code:
<?php echo form_open('admin/posts/post/'.$post->id); ?>
// other fields here...

<div class="form-group">
                <label for="visible" class="col-sm-2">Visible</label>
                <div class="col-sm-10">
                    <div class="onoffswitch">
                        &lt;?php  
                            $is_checked = ($post->visible) ? $post->visible : $this->input->post('visible');
                            $visible = array(
                                'class' => 'onoffswitch-checkbox',
                                'id' => 'visible',
                                'checked' => ($is_checked == '1') ? true : false,
                                'name' => 'visible',
                                'value' => $is_checked,
                                );
                        ?&gt;
                        &lt;?php echo form_checkbox($visible); ?&gt;
                        <label class="onoffswitch-label" for="visible">
                            <div class="onoffswitch-inner"></div>
                            <div class="onoffswitch-switch"></div>
                        </label>
                    </div>
                </div>
            </div>


// more fields here ...
&lt;?php echo form_close(); ?&gt;
Basicly this works as an on/off switch button. The problem is that when I click the submit button of the form, I cannot get the $_POST data of the field ( $this->input->post('visible') ) in order to pass it to my model and store it in the database.

Any ideas what I'm doing wrong and how should fix it?


Messages In This Thread
Not getting the value from the on/off switch checkbox - by El Forum - 03-31-2014, 12:03 AM
Not getting the value from the on/off switch checkbox - by El Forum - 03-31-2014, 02:18 AM
Not getting the value from the on/off switch checkbox - by El Forum - 03-31-2014, 04:38 AM
Not getting the value from the on/off switch checkbox - by El Forum - 03-31-2014, 11:50 PM
Not getting the value from the on/off switch checkbox - by El Forum - 04-01-2014, 12:00 AM
Not getting the value from the on/off switch checkbox - by El Forum - 04-01-2014, 12:42 AM
Not getting the value from the on/off switch checkbox - by El Forum - 04-03-2014, 11:31 PM
Not getting the value from the on/off switch checkbox - by El Forum - 04-04-2014, 02:03 PM



Theme © iAndrew 2016 - Forum software by © MyBB