title: Saving multiple HTML textareas in CodeIgniter
body: <p>I would like to grab the values of several textarea fields and save them to the database. For now I have four of each with different values and I want to batch save these values, the textarea fields are:</p>
  
  <pre><code>&lt;textarea  name="compedia[]"&gt;&lt;/textarea&gt;
  &lt;textarea name="specification[]"&gt;&lt;/textarea&gt;
  </code></pre>
  
  <p>and the save function:</p>
  
  <pre><code>function saveCOA(){
      $labref=$this-&gt;uri-&gt;segment(3);
      $data=  $this-&gt;input-&gt;post('compedia');
      $data1=  $this-&gt;input-&gt;post('specification');
      $compedia=array(
          'labref'=&gt;$labref, //NDQA201303001
          'compedia'=&gt;$data,
          'specification'=&gt;$data1
      );
      foreach ($compedia as $value) {
          $this-&gt;db-&gt;insert('coa_body',$value);  
      }
  
  }
  </code></pre>
  
  <p>When I <code>print_r($value)</code> it returns :</p>
  
  <pre><code>NDQA201303001
  Array ( [0] =&gt; Alphy [1] =&gt; poxy [2] =&gt; alphy [3] =&gt; poxy )
  Array ( [0] =&gt; poxy [1] =&gt; alphy [2] =&gt; poxy [3] =&gt; alphy )
  </code></pre>
  
  <p>and when I try to save, it returns:</p>
  
  <pre><code>A Database Error Occurred
  
  Error Number: 1054
  
  Unknown column 'NDQA201303001' in 'field list'
  
  INSERT INTO `coa_body` (`NDQA201303001`) VALUES ('')
  
  Filename: C:\xampp\htdocs\NQCL\system\database\DB_driver.php
  
  Line Number: 330
  </code></pre>
  
  <p>How should the syntax be so as to loop over all the textarea values and save them to the database at once?</p>