GET parameters in the URL with CodeIgniter GET parameters in the URL with CodeIgniter codeigniter codeigniter

GET parameters in the URL with CodeIgniter


When I first started working with CodeIgniter, not using GET really threw me off as well. But then I realized that you can simulate GET parameters by manipulating the URI using the built-in URI Class. It's fantastic and it makes your URLs look better.

Or if you really need GETs working you can put this into your controller:

parse_str($_SERVER['QUERY_STRING'], $_GET); 

Which will put the variables back into the GET array.


This function is identical to the post function, only it fetches get data:

$this->input->get()

https://www.codeigniter.com/user_guide/libraries/input.html


This worked for me :

<?php$url = parse_url($_SERVER['REQUEST_URI']);parse_str($url['query'], $params);?>

$params array contains the parameters passed after the ? character