[eluser]Achmed1[/eluser]
Hi,
I got a problem im trying to get the the post value from the do_purchase function to the function redirect.
Here my code im using a paypal libary
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Home extends CI_Controller {
public function __construct(){
parent::__construct();
}
public function index()
{
$this->load->view('view_home');
}
public function do_purchase(){
$this->load->helper('string');
$config['business'] = 'myemail';
$config['cpp_header_image'] = 'test'; //Image header url [750 pixels wide by 90 pixels high]
$config['return'] = 'http://localhost/test/home/redirect/';
$config['cancel_return'] = 'http://localhost/codeigniter_lab/payments/cancel_payment';
$config['production'] = FALSE; //Its false by default and will use sandbox
$config["invoice"] = random_string('numeric',8); //The invoice id
$this->load->library('paypal',$config);
$price = $this->input->post("myselect");
$this->paypal->add('test',$price,1);
$this->paypal->pay();
}
public function submitting()
{
$this->do_purchase();
}
public function redirect ()
{
if($this->input->post())
{
echo $price;
}else{
echo "false";
}
}
}