samedi 26 décembre 2015

Codeigniter checkbox returns always 0

I've a form to add a project with a checkbox if the project is already finished or not. This is the html in the view (codeigniter):

<div class="form-group">
                            <label>Task completed:</label>
                            <input type="checkbox" class="form-control" id="task_completed" name="task_completed" />
                            <?php echo form_error('task_completed'); ?>

                        </div>

I load the data in my controller:

$checked = (int)$this->input->post('task_completed');

when i do a echo "" . $checked; it's always 0!! Also, in my database. Where is my fault?




Aucun commentaire:

Enregistrer un commentaire