Shital Pimpale
Shital Pimpale

Reputation: 45

how to pass variable in url in codeigniter

I am integrating instamojo payment gateway in website.i am using codeigniter framework.

I passed redirect URL as

http://localhost/example/instapayment/redirect

So i get response as follow:

http://localhost/example/instapayment/redirect?payment_id=MOJO612323222&status=success

i am redirecting to base_url. My route is

$route['redirect/(:any)'] = 'instapayment/redirect/$1';

Now i am not getting how to access status and payment_id.

Upvotes: 0

Views: 1677

Answers (2)

Bikash
Bikash

Reputation: 1938

if you have to pass the value you should enter url like this

localhost/yoururl/index.php/products_controller/delete_controller/70

and in controller function you can read like this

function delete_controller( $product_id = NULL ) {
 echo $product_id;
}

Upvotes: 1

Vivek Singh
Vivek Singh

Reputation: 2447

http://localhost/example/instapayment/redirect?payment_id=MOJO612323222&status=success

if passing the variable in url that is bad practice , still if u want this u can use

$this->input->post() //for post menthod

$this->input->get()// for get method

Upvotes: 0

Related Questions