Welcome Guest, Not a member yet? Register   Sign In
sending GET parameter to controller index function
#1

[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.
#2

[eluser]Yash[/eluser]
This is what you need

http://ellislab.com/codeigniter/user-gui...s/uri.html
#3

[eluser]llbbl[/eluser]
sending URL's via GET is quite tricky. I have used sessions to avoid this in CI.
#4

[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.
#5

[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.




Theme © iAndrew 2016 - Forum software by © MyBB