Welcome Guest, Not a member yet? Register   Sign In
I need some help with GET variables
#1

[eluser]Clifford James[/eluser]
Goodmorning!

I'm not able to read the GET variable search from this url: http://anyshop.nl/search?search=trixie

What am I doing wrong? Enabling query strings and changed the uri protocol a couple of times but
I just can't get it to work.

My .htaccess
Code:
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    #Removes access to the system folder by users.
    #Additionally this will allow you to create a System.php controller,
    #previously this would not have been possible.
    #'system' can be replaced if you have renamed your system folder.
    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]

    #Checks to see if the user is attempting to access a valid file,
    #such as an image or css document, if this isn't true it sends the
    #request to index.php
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>
    # If we don't have mod_rewrite installed, all 404's
    # can be sent to index.php, and everything works as normal.
    # Submitted by: ElliotHaughin

    ErrorDocument 404 /index.php
</IfModule>

My routes:
Code:
$route['default_controller']  = "home_controller";
$route['scaffolding_trigger'] = "";

$route['admin']             = "admin/admin_controller/index";
$route['admin/([^/]*)(.*)'] = "admin/$1_controller$2";

$route['search'] = "search_controller";

$route['login']    = "account_controller/login";
$route['register'] = "account_controller/register";

$route['(:any)/(:any)/(:any)'] = "product_controller/view/$1/$2/$3";
$route['(:any)/(:any)']        = "category_controller/view/$1/$2";
$route['(:any)']                = "category_controller/view/$1";

My config:
Code:
$config['uri_protocol']    = "AUTO";
$config['enable_query_strings'] = FALSE;

My controller:
Code:
&lt;?php

class Search_controller extends MY_controller {

    function index() {

        var_dump($this->input->get('search'));

    }

}
#2

[eluser]WanWizard[/eluser]
Have you searched the forum for an answer? This issue has been discussed before.

CI doesn't support GET variables out of the box. The setting 'enable_query_strings' doesn't do that, it's meant for routing using the query string instead of URI segments.
#3

[eluser]Clifford James[/eluser]
Yes, I do have searched the forum. Do you have a link the the post that discussed my problem?

Thanks.
#4

[eluser]Clifford James[/eluser]
Any ideas, someone?
#5

[eluser]Clooner[/eluser]
There are many solutions to your problem. I would suggest recovering the get parameters like so http://ellislab.com/forums/viewreply/782850/. Search the forum for other solutions!




Theme © iAndrew 2016 - Forum software by © MyBB