I have a Table column named active which may have a value 1 or 0
in my add.ctp I am creating a checkbox using
<?php echo $this->Form->checkbox('active'); ?>
and similarly in my edit.ctp template
but regardless of if the checkbox is checked or unchecked the value saved in Database is always 1 and i also don’t know in the active=1 how to set it to checked
Assuming the database column is a BOOLEAN type. You should create the checkbox like this instead:
It should automatically output it as a checkbox..
If it doesn’t, try clearing the model cache in
tmp/cache/modelsand trying again