title: codeigniter - add multiple item into cart by checked checkbox jquery
body: <p>i'm trying to add multiple item into the cart based on  checked checkbox,
  let's straight to the point.</p>
  
  <p>the view</p>
  
  <pre><code>&lt;table width="100%" id="product-row"&gt;
                          &lt;tr&gt;
                              &lt;td&gt;ID  &lt;/td&gt;
                              &lt;td&gt;DESCRIPTION&lt;/td&gt;
                              &lt;td style="width:200px"&gt;ACTION&lt;/td&gt;
                          &lt;/tr&gt;
                          &lt;tr&gt;
  
                              &lt;?php
                                      $attr=array('id'=&gt;'add-item');
                                      echo form_open('cart/add_piece',$attr);
                              ?&gt;
                              &lt;?php foreach($product-&gt;result_array() as $p) : ?&gt;
                              &lt;td&gt;
                                  &lt;p&gt;
                                      &lt;?php echo $p['ITEMNO'];?&gt;
                                  &lt;/p&gt;
                              &lt;/td&gt;
                              &lt;td&gt;
                                  &lt;p&gt;
                                      &lt;?php echo $p['DESCRIPTION']?&gt;
                                  &lt;/p&gt;
                              &lt;/td&gt;
                              &lt;td&gt;
                                      &lt;?php echo form_input(array('name' =&gt; 'quantity[]', 'value' =&gt; '1', 'maxlength' =&gt; '5', 'size' =&gt; '5','class' =&gt; 'quantity textbox', 'placeholder'=&gt;'0')); ?&gt;
                                      &lt;input type ="hidden" name="description[]" value="&lt;?php echo $p['DESCRIPTION']?&gt;"&gt;&lt;/input&gt;
                                      &lt;input type="checkbox" value="&lt;?php echo $p['ITEMNO'];?&gt;" name="itemno[]"&gt;Ambil&lt;/input&gt;
                              &lt;/td&gt;
                          &lt;/tr&gt;
                          &lt;?php endforeach;?&gt;
                      &lt;/table&gt;
                      &lt;input class="btn_pro_bypcs" type="image"   src="&lt;?php echo base_url();?&gt;assets/images/green-add.png" id="submit" alt="Add To Cart" width="70" height="30"/&gt;
  &lt;?php echo form_close();?&gt;
  </code></pre>
  
  <p>THE CONTROLLER:</p>
  
  <pre><code>function add_piece()
      {
          if($this-&gt;session-&gt;userdata('logged_in'))
          {
              if($this-&gt;item_model-&gt;validate_add_item_piece()== TRUE)
              {
                  if($this-&gt;input-&gt;post('ajax') != 1)
                  {
                      redirect('cart');
                  }
                  else
                  {
                      echo "Item Added";
                  }
              }
          }
          else
          {
              echo "&lt;div style='background-color:red;'&gt;Failed to add item!&lt;/div&gt;";
          }
  
      }
  </code></pre>
  
  <p>the model:</p>
  
  <pre><code>$itemno=$this-&gt;input-&gt;post('itemno');
          $quantity = $this-&gt;input-&gt;post('quantity');
          $desc=$this-&gt;input-&gt;post('description');
          foreach($itemno as $i)
          {
              for($i=0;$i&lt; count($itemno);$i++)
              {
              $data= array(
  
                  'id'    =&gt; $itemno[$i],
                  'name'  =&gt; $desc[$i],
                  'qty'   =&gt; $quantity[$i],
                  'price' =&gt; 1
  
              );
              $this-&gt;cart-&gt;insert($data);
              }
              return TRUE;
          }
  </code></pre>
  
  <p>the php is working fine, but
  the question is, how do i add the items into the cart using jquery?</p>