how to retrieve HTTP $_GET values with CodeIgniter how to retrieve HTTP $_GET values with CodeIgniter codeigniter codeigniter

how to retrieve HTTP $_GET values with CodeIgniter


$this->input->get() or $this->input->get_post()


CodeIgniter comes with three helper functions that let you fetch POST, COOKIE or SERVER items. The main advantage of using the provided functions rather than fetching an item directly ($_POST['something']) is that the functions will check to see if the item is set and return false (boolean) if not. This lets you conveniently use data without having to test whether an item exists first. In other words, normally you might do something like this:

if (!isset($_GET['something'])){    $something = FALSE; } else {    $something = $_GET['something']; } 

With CodeIgniter's built in functions you can simply do this:

$something = $this->input->get('something');

Taken from here.


use Input::get():

echo $this->input->get('your_field');