title: How to input multiple value with checkbox in CodeIgniter?
body: <p>I have prepared the form to be inputted to the database, but specifically for multiple checkboxes. I've found a similar case with the solutionbut not with the algorithm that I use</p>
  
  <p>Here it is my controller</p>
  
  <pre><code>class Ruang extends CI_Controller {
  
      public function __construct(){
          parent::__construct();
          $this-&gt;load-&gt;model("m_ruang");
          $this-&gt;load-&gt;library('form_validation');
          if($this-&gt;session-&gt;userdata('status') != "login"){
              redirect(base_url("login"));
          }
      }
  
      public function index()
      {
          $data["ruang"] = $this-&gt;m_ruang-&gt;getAll();
          $this-&gt;load-&gt;view('admin/ruang/index.php', $data);
      }
  
      public function add()
      {
          $ruang = $this-&gt;m_ruang;
          $validation = $this-&gt;form_validation;
          $validation-&gt;set_rules($ruang-&gt;rules());
  
          if ($validation-&gt;run()) {
              $ruang-&gt;save();
              $this-&gt;session-&gt;set_flashdata('success', 'Berhasil ditambahkan');
          }   
  
          $this-&gt;load-&gt;view("admin/ruang/add_ruang");
      }
  </code></pre>
  
  <p>Here it is my models</p>
  
  <pre><code>class M_ruang extends CI_Model
  {
      private $_table = "ruang";
  
      public $id_ruang;
      public $ruang;
      public $kapasitas_kuliah;
      public $kapasitas_ujian;
      public $layout;
      public $fasilitas;
  
  public function getAll()
      {
          return $this-&gt;db-&gt;get($this-&gt;_table)-&gt;result();
      }
  
      public function getById($id)
      {
          return $this-&gt;db-&gt;get_where($this-&gt;_table, ["id_ruang" =&gt; $id])-&gt;row();
      }
  
      public function save()
      {
          $post = $this-&gt;input-&gt;post();
          $this-&gt;id_ruang = uniqid();
          $this-&gt;ruang = $post["ruang"];
          $this-&gt;kapasitas_kuliah = $post["kapasitas_kuliah"];
          $this-&gt;kapasitas_ujian = $post["kapasitas_ujian"];
          $this-&gt;layout = $post["layout"];
          $this-&gt;fasilitas = $post["fasilitas"];
          $this-&gt;db-&gt;insert($this-&gt;_table, $this);
      }
  </code></pre>
  
  <p>and here part of form view</p>
  
  <pre><code>&lt;form action="&lt;?php base_url('ruang/add') ?&gt;" method="post" enctype="multipart/form-data" &gt;
  
                      &lt;div class="form-group"&gt;
                          &lt;label for="ruang"&gt;Nama Ruang&lt;/label&gt;
                              &lt;input class="form-control &lt;?php echo form_error('ruang') ? 'is-invalid':'' ?&gt;"
                                  type="text" name="ruang" placeholder="Masukkan nama ruangan" /&gt;
                          &lt;div class="invalid-feedback"&gt;
                              &lt;?php echo form_error('ruang') ?&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
  
                      &lt;div class="form-group"&gt;
                          &lt;label for="kapasitas_kuliah"&gt;Kapasitas Kuliah&lt;/label&gt;
                              &lt;input class="form-control &lt;?php echo form_error('kapasitas_kuliah') ? 'is-invalid':'' ?&gt;"
                                  type="number" name="kapasitas_kuliah" min="0" placeholder="Tentukan kapasitas kuliah" /&gt;
                          &lt;div class="invalid-feedback"&gt;
                              &lt;?php echo form_error('kapasitas_kuliah') ?&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
  
                      &lt;div class="form-group"&gt;
                          &lt;label for="kapasitas_ujian"&gt;Kapasitas Kuliah&lt;/label&gt;
                              &lt;input class="form-control &lt;?php echo form_error('kapasitas_ujian') ? 'is-invalid':'' ?&gt;"
                                  type="number" name="kapasitas_ujian" min="0" placeholder="Tentukan kapasitas ujian" /&gt;
                          &lt;div class="invalid-feedback"&gt;
                              &lt;?php echo form_error('kapasitas_ujian') ?&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
  
                      &lt;div class="form-group"&gt;
                          &lt;label for="layout"&gt;Layout&lt;/label&gt;
                              &lt;input class="form-control" 
                              data-inputmask="'mask': ['99 x 99']" data-mask 
                                  type="text" name="layout" placeholder="Tentukan layout ruangan" /&gt;
                      &lt;/div&gt;
  
                      &lt;div class="form-group"&gt;
                          &lt;label for="fasilitas"&gt;Fasilitas Tersedia&lt;/label&gt; &lt;br&gt;
                              &lt;input type="checkbox" name="fasilitas[]" value="Proyektor"&gt; Proyektor
                              &lt;br&gt;
                              &lt;input type="checkbox" name="fasilitas[]" value="Papan Tulis"&gt; Papan Tulis
                              &lt;br&gt;
                              &lt;input type="checkbox" name="fasilitas[]" value="Jam Dinding"&gt; Jam Dinding
                              &lt;br&gt;
                              &lt;input type="checkbox" name="fasilitas[]" value="AC"&gt; AC
                              &lt;br&gt;
                              &lt;input type="checkbox" name="fasilitas[]" value="Kipas Angin"&gt; Kipas Angin
                              &lt;br&gt;
                              &lt;input type="checkbox" name="fasilitas[]" value="Tong Sampah"&gt; Tong Sampah
                          &lt;div class="invalid-feedback"&gt;
                              &lt;?php echo form_error('fasilitas') ?&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
  
                      &lt;input class="btn btn-success" type="submit" name="btn" value="Save" /&gt;
                  &lt;/form&gt;
  </code></pre>
  
  <p>This really hinders my project, I hope someone can help</p>