title: Codeigniter Insert Batch array
body: <p>I am Inserting a multiple form input data in to database using Codeigniter. 
  I have this post input array:</p>
  
  <pre><code> Array
  (
   [subject_id] =&gt; Array
      (
          [0] =&gt; 1
          [1] =&gt; 1
      )
  
  [question] =&gt; Array
  
      (
          [0] =&gt; test
          [1] =&gt; test2
      )
  
  [option1] =&gt; Array
      (
          [0] =&gt; test
          [1] =&gt; test2
      ) )
  </code></pre>
  
  <p>I don't get that how do i convert this array to insert How to insert this array using Insert batch.</p>
  
  <pre><code>$this-&gt;db-&gt;insert_batch('mytable', $data);
  </code></pre>
  
  <p>This is the form code which i use for posting the data:</p>
  
  <pre><code>                &lt;form method="post"&gt;
              &lt;input type="text" name="subject_id[]" &gt;
              &lt;input type="text" name="question[]" &gt;
              &lt;input type="text" name="record[]" &gt;
  
              // Down side Part is appended when user want to add more question
  
              &lt;input type="text" name="subject_id[]" &gt;
              &lt;input type="text" name="question[]" &gt;
              &lt;input type="text" name="record[]" &gt;
  
              &lt;input type="submit" name="submit" &gt;
              &lt;/form&gt;
  </code></pre>
  
  <p>Below is the Array format which i want.</p>
  
  <pre><code>$data = array(
              array(
                  'subject_id' =&gt; 'My title' ,
                  'question' =&gt; 'My Name' ,
                  'option1' =&gt; 'My date'
                  ),
              array(
                  'subject_id' =&gt; 'Another title' ,
                  'question' =&gt; 'Another Name' ,
                  'option1' =&gt; 'Another date'
                  )
              );
  </code></pre>