Maninderpreet Singh
Maninderpreet Singh

Reputation: 2587

$_GET in Case 'get'

In codeigniter's controller the $_GET['variable'] not working in case 'GET' for Example:

case 'GET';
if(isset($_GET['variable'])){
//do somthing
}

After URL contains ?variable=1 the if condition always fails I don't know why?

Upvotes: 1

Views: 102

Answers (3)

viral
viral

Reputation: 3743

Check this in your config.php file $config['allow_get_array'] = TRUE; and access query string parameters with $this->input->get('variable')

Upvotes: 3

George
George

Reputation: 746

Try to use $this->input->post('var')

if($this->input->post('var')){
     //do somthing
}

Upvotes: 1

Saty
Saty

Reputation: 22532

for getting $_GET value in codeigniter you use:-

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

and make sure this is true in your config.php file

$config['allow_get_array']      = TRUE; 

and you must have to add

$config['uri_protocol'] = "PATH_INFO";

Upvotes: 1

Related Questions