CodeIgniter Forums
Passing $_GET to controller unexpeacted error. - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Passing $_GET to controller unexpeacted error. (/thread-38528.html)



Passing $_GET to controller unexpeacted error. - El Forum - 02-10-2011

[eluser]arbme666[/eluser]
Hi,

When I go to a url say index.php/foo? is will load the page fine but if I go to index.php/foo?bar it will load my default controller.

I am a bit confused I thought you could pass GET vars or I would expect it to through a 404 error.

Any ideas


Passing $_GET to controller unexpeacted error. - El Forum - 02-11-2011

[eluser]ChrisMiller[/eluser]
It is not hard to setup

First open up /system/application/config.php

Change
Code:
$config['uri_protocol']    = "AUTO";
To:
Code:
$config['uri_protocol']    = "PATH_INFO";

and then open up your index.php file and add near the top of the file
Code:
parse_str($_SERVER['QUERY_STRING'],$input_vars);

Special notice is $input_vars is not safe from sql injection etc... it basically gives you exactly what was inputed you must sanatize this manually via... $this->security->xss_clean()

http://ellislab.com/codeigniter/user-guide/libraries/security.html Wink

you may have to also do the Url Suffix as well as its been awhile since I did this trick but that would be the variable
$config['url_suffix'] in the same config file just below the uri_protocol.