title: Submit Array type input file in database
body: <p>I have a form, which has two fields: "product_name" and "product_q" and in my form i have an option to increase the number of fields in <code>product_name</code> and <code>product_q</code></p>
  
  <pre><code> &lt;select name="product_name[]" id="product_name"&gt;
   &lt;option value="please select"&gt;&lt;/option&gt; 
   &lt;option value="1"&gt;demo1&lt;/option&gt; 
   &lt;option value="2"&gt;demo2&lt;/option&gt; 
  
   &lt;/select&gt;
  
  &lt;select name="product_q[]" id="product_q"&gt;
   &lt;option value="please select"&gt;&lt;/option&gt; 
   &lt;option value="1"&gt;1&lt;/option&gt; 
   &lt;option value="2"&gt;2&lt;/option&gt; 
  
   &lt;/select&gt;
  </code></pre>
  
  <p>and an action page like </p>
  
  <pre><code> public function order(){
  
  
      $Product_q = $this-&gt;input-&gt;post('quantity');
      $sponserid = $this-&gt;session-&gt;userdata('number');
      $pname['product_name'] = $this-&gt;input-&gt;post('product_name');
      foreach($Product_q as $key =&gt; $value){
      $data['Product_q'] = $value;
      $data['Product_Name'] = $pname['product_name'][$key]; 
      $this-&gt;mymodel-&gt;insert_items($data);
  
      }
  </code></pre>
  
  <p>and my model</p>
  
  <pre><code>function insert_items($data){
      $this-&gt;db-&gt;insert("lucky_order", $data);
      return;
  
  }
  </code></pre>
  
  <p>Please help to insert data database my form look like this:</p>
  
  <p><strong>FORM with one field</strong><br/>
  <a href="https://i.stack.imgur.com/CaBOh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CaBOh.png" alt="FORM with one field"></a></p>
  
  <p><strong>Form with two field</strong><br/>
  <a href="https://i.stack.imgur.com/SZtL8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SZtL8.png" alt="form with two field"></a></p>