Welcome Guest, Not a member yet? Register   Sign In
How display checked filter variable value in url

I am a basic user of code igniter and PHP.I have some products page with filters. How to created a URL link like this:
I know I can do above url when I will change the config line:
$config['enable_query_strings'] = FALSE; on TRUE.

But I want to use this option only one controller and one function.
I can write same code whitch it will filter this products by color for example, but I want create link like on top. People will be able to share this link.

Simply use $this->input->get('color') in your controller to fetch the variable that was passed in the query string.
You don't need to change the setting of $config['enable_query_strings'). If you would set to true, CI will no longer accept url's with segments, but it wants the controller and method as query string variables too. E.g.:
PHP Code:

With $config['enable_query_strings') set to false, your url will do just fine.
Remember to process the get variables in the index method of the controller, because CI expects a controller and a method in the url. If you omit the method, CI points to the index method in the given controller.

Thanks for this. I thought get var was disable in codeigniter.

Theme © iAndrew 2016 - Forum software by © MyBB