我无法将复选框的值发送到数据库Codeigniter

时间:2019-01-31 07:36:10

标签: codeigniter

enter image description here

// myController

public function insertNewRole($select_access){


    if(!empty($this->input->post($select_access)))
         {
        foreach ( $this->input->post($select_access) as $obj)
            {
                $select_access[]= $obj; 
            }
         }

         $this->RoleModel->saveRole($select_access);

}

// myModel

public function saveRole()
{

    $checkboxes = $this->input->post($select_access);
      foreach($checkboxes as $obj)
      {
         $this->db->insert('roles_global_access',array($select_access=>$obj));
      }

}

0 个答案:

没有答案