![]() |
sending GET parameter to controller index function - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: sending GET parameter to controller index function (/showthread.php?tid=11852) |
sending GET parameter to controller index function - El Forum - 09-25-2008 [eluser]Unknown[/eluser] Hi, I'm new in CI. I got no idea if there is any possibility to send GET parameter or GET variables to controllers index function except index.php/controller/index/parameter. Is it somehow possible to eliminate that "index" segment? I am looking for some possibility of nonproblematical GETing parameters to any functions of any controller. sending GET parameter to controller index function - El Forum - 09-25-2008 [eluser]Yash[/eluser] This is what you need http://ellislab.com/codeigniter/user-guide/libraries/uri.html sending GET parameter to controller index function - El Forum - 09-25-2008 [eluser]llbbl[/eluser] sending URL's via GET is quite tricky. I have used sessions to avoid this in CI. sending GET parameter to controller index function - El Forum - 09-25-2008 [eluser]onejaguar[/eluser] Assuming you are using path segments for controller routing; you can put GET variables back into the $_GET array with with this command in your controller: Code: parse_str($_SERVER['QUERY_STRING'], $_GET); For this to work the app's main config must be set explicitly to: Code: $config['uri_protocol'] = "PATH_INFO"; Then simply add ?... parameters to your URL or set a form that calls your controller to type GET. sending GET parameter to controller index function - El Forum - 01-09-2009 [eluser]Phil Sturgeon[/eluser] I think azbest208 is trying to send URI segment parameters to the controller without the URI /controller/index/param1. To do that add a new route in config/routes.php. Code: $route['controller/(:num)'] = "controller/index/$1"; Otherwise if you just want to enabled $_GET over the entire site and allow ?param1=whatever, then read the post [SOLVED] How to use URI Segments and Query Strings in the same project. |