Hi all
I have a table Category contain field , id, name, description with value
id | name | description |
---|---|---|
1 | Backend | this is backend |
2 | Frontend | this is frontend |
3 | Other | this is orther |
and FormPost look like
class PostForm extends Form
{
foreach (Category::find() as $key => $value) {
$this->add(new Check('idCat[]', array('value' => $value->id)));
}
[..]
}
Then in view I user render form but it get last value
<input type="checkbox" class="form-control input-sm" value="3" name="idCat[]">
My question, how to get result look like
<input type="checkbox" class="form-control input-sm" value="1" name="idCat[]">
<input type="checkbox" class="form-control input-sm" value="2" name="idCat[]">
<input type="checkbox" class="form-control input-sm" value="3" name="idCat[]">