My DB column name subscribed tinyint(1),
I want if checkBox is checked then value send 1 if not checked then value send 0.
This is my code-
<?php echo $form->checkBox($model,'subscribed'); ?>
Please help.
In your view file:
<?php echo $form->checkBox($model,'attribute'); ?> //in your case 'attribute' is 'subscribed'
in your controller
<?php
//if checked, return 1;
//if unchecked, return 0;
.........
$checkbox_value=$model->attribute; //in your case 'attribute' is 'subscribed'
echo $checkbox_value;
.......
?>