title: how to get cart values in codeigniter for paypal payment gateway
body: <p>I am stuck on integrating paypal payment gateway on codeigniter
   I am using the current library 
  <a href="https://github.com/romaldyminaya/ci_paypal" rel="nofollow">https://github.com/romaldyminaya/ci_paypal</a></p>
  
  <p>As the library contains only static values of the items , but i need to get the items that are coming from my cart, how can i get them to the <strong>$this->paypal->add('T-shirt',2.99,6);</strong></p>
  
  <p><strong>my controller function:</strong></p>
  
  <pre><code>    public function do_purchase(){
  
      $config['business']             = 'babar.seller@gmail.com';
          $config['cpp_header_image']     = ''; //Image header url [750 pixels wide by 90 pixels high]
          $config['return']               = 'http://localhost/final-project/index.php/mysite/modify_payment';
          $config['cancel_return']        = 'http://final-project/mysite/canceled.php';
          $config['notify_url']           = 'process_payment.php'; //IPN Post
          $config['production']           = FALSE; //Its false by default and will use sandbox
          $config["invoice"]              = random_string('numeric',8); //The invoice id
  
          $this-&gt;load-&gt;library('paypal',$config);
  
          #$this-&gt;paypal-&gt;add(&lt;name&gt;,&lt;price&gt;,&lt;quantity&gt;[Default 1],&lt;code&gt;[Optional]);
  
          $this-&gt;paypal-&gt;add('T-shirt',2.99,6); //First item
          $this-&gt;paypal-&gt;add('Pants',40);       //Second item
          $this-&gt;paypal-&gt;add('Blowse',10,10,'B-199-26'); //Third item with code
  
  
          $this-&gt;paypal-&gt;pay(); //Proccess the payment
  
      }
  
      public function modify_payment(){
  
  
          $received_data = print_r($this-&gt;input-&gt;post(),TRUE);
          echo "&lt;pre&gt;".$received_data."&lt;pre&gt;";
  
                  $this-&gt;load-&gt;view('mysite/modify_payment',$received_data);
  
          }
  
  public function cart()
  
      {
          $cart = $this-&gt;cart-&gt;contents();
          //print_r($cart);
          //die;
        //$data['user_id']=$this-&gt;mainmodel-&gt;get_user_i($user_id);    
  
          $this-&gt;load-&gt;view('mysite/cart');
          $this-&gt;load-&gt;view('mysite/include/footer');
  
  
      }
  </code></pre>
  
  <p><strong>cart view :</strong></p>
  
  <pre><code>    &lt;?php $i = 1; ?&gt;
  
  &lt;?php foreach ($this-&gt;cart-&gt;contents() as $items): ?&gt;
  
      &lt;?php echo form_hidden($i.'[rowid]', $items['rowid']); ?&gt;
      &lt;tr&gt;
  &lt;td&gt;         &lt;input name="qty[&lt;?php echo $items['rowid'];?&gt;]" id="qty" type="text" value="&lt;?php echo $items['qty']?&gt;" class="input" /&gt;
  &lt;/td&gt;
        &lt;td&gt;
          &lt;?php echo $items['name']; ?&gt;
  
              &lt;?php if ($this-&gt;cart-&gt;has_options($items['rowid']) == TRUE): ?&gt;
  
                  &lt;p&gt;
                      &lt;?php foreach ($this-&gt;cart-&gt;product_options($items['rowid']) as $option_name =&gt; $option_value): ?&gt;
  
                          &lt;strong&gt;&lt;?php echo $option_name; ?&gt;:&lt;/strong&gt; &lt;?php echo $option_value; ?&gt;&lt;br /&gt;
  
                      &lt;?php endforeach; ?&gt;
                  &lt;/p&gt;
  
              &lt;?php endif; ?&gt;
  </code></pre>