views:

80

answers:

3

i already make two changes in config file to enable the $_GET array as

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

but whenever i try tow run my code as http://example.com/controller/function/$demo=demo it redirected towards the default controller

+1  A: 

You also have to set controller and function triggers from config:

$config['enable_query_strings'] = TRUE;
$config['controller_trigger'] = 'c';
$config['function_trigger'] = 'm';

So once query string is enabled, you can access it like this:

http://example.com/index.php?c=controller&m=function&demo=demo
Sarfraz
+2  A: 

Enabling query strings in CodeIgniter means that you're using the query string to pass in the controller and function instead of them being parsed from the PATH INFO.

If you want to use the default system for determining what controller and function to use, you do not want to set $config['enable_query_strings'] to true.

This previous SO post covers how to enable teh $_GET array in CodeIgniter: http://stackoverflow.com/questions/2043070/enabling-get-in-codeigniter

I think that's what you're trying to do.

ebynum
A: 

Just came across this problem myself and along with enabling query strings in the config file I also had to pass in more than 1 parameter in the URL.

See this answer for more details:
Combine friendly url and query string

James F