title: Is there a way to send array of textbox and checbox from View To Controller (CodeIgniter)
body: <p>I am building a store front with CodeIgniter where list of items from the database is displayed with a checkbox in the View. The user is to select items and enter their quantity. When the user Click Send, the list of Items and their quantity that user set will be submitted to the Database.</p>
  
  <p>Here is the View Code:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code> &lt;table&gt;
                    &lt;thead&gt;
                    &lt;tr&gt;
                        &lt;th&gt;SN&lt;/th&gt;
                        &lt;th&gt;Product&lt;/th&gt;&lt;th&gt;Tick&lt;/th&gt;
                        &lt;th&gt;quantity&lt;/th&gt;
  
                    &lt;/tr&gt;
                    &lt;/thead&gt;
                      &lt;tbody&gt;
                      &lt;?php
                      $i=0;
                      foreach($it as $r):
                      $i++;
                      ?&gt;
                      &lt;tr&gt;&lt;td&gt;&lt;?php echo $i; ?&gt;&lt;/td&gt;
                          &lt;td&gt;&lt;?=$r['Item'];?&gt;&lt;/td&gt;
                          &lt;td&gt;
                          &lt;input type="checkbox" name="item[]" value="&lt;?=$r['Item']?&gt;" /&gt;&lt;/td&gt;
                          &lt;/td&gt; 
                          &lt;td&gt;
                              &lt;input type="number" name="qty[]" /&gt;
                             &lt;/td&gt;
                         &lt;/tr&gt; &lt;?php endforeach?&gt;
                      &lt;tr&gt;&lt;td colspan="3"&gt;
                              &lt;input type="submit" name="btnub" value="Send Order" /&gt;&lt;/td&gt;&lt;/tr&gt;
                      &lt;/tbody&gt;
                  &lt;/table&gt;
  
  &lt;!-- Controller Code (CodeIgniter) --&gt;
  
  &lt;!-- CodeIgniter Controller Code to harvest the Order  --&gt;
  
   if (isset($_POST['btnub'])) {
              foreach($_POST['item'] as $key=&gt;$item) {
                  for ($i = 1; $i &lt; 2000; $i++) {
                      $h = "qty" . $i;
                          $qty = $this-&gt;input-&gt;post[$h];
                      }
                      $tt = array(
                          'item' =&gt; $item,
                          'Qty' =&gt; $qty,
                      );
                      $this-&gt;tranmodel-&gt;insertthing("cuzorder", $tt);
              }  }</code></pre>
  </div>
  </div>
  </p>