我想創建遞歸表選中複選框基本ID,我喜歡這個顯示選中的複選框基地遞歸ID在笨
+---------+--------------+-----------+
|user_id | function_id | feature_id|
+---------+--------------+-----------+
| 1 | 2 | 1 |
+---------+--------------+-----------+
| 1 | 2 | 2 |
+---------+--------------+-----------+
| 1 | 2 | 3 |
+---------+--------------+-----------+
,然後選中複選框表使用的foreach
$feature = $this->db->get_where('my_table', array('function_id' => '2'))->result();
foreach ($result as $value)
{
$data = array(
'name' => 'feature_id',
'value' => $value->feature_id,
'checked' => // depend on feature_id if in function_id the feature id is exist then checked TRUE else FALSE
);
echo form_checkbox($data);
PLZ有幫我! :(
可能是重複的http://stackoverflow.com/questions/8878986/how-to-set-value-of-checkbox-in-codeigniter-and-show-checked-state – siddhesh
@yulianto你可以請檢查我的答案請讓我知道,如果它在爲你工作嗎? –