![]() |
INPUT CLASS destroys global get? - 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: INPUT CLASS destroys global get? (/showthread.php?tid=17529) Pages:
1
2
|
INPUT CLASS destroys global get? - El Forum - 04-07-2009 [eluser]RJ[/eluser] Quote:Destroys the global GET array. Since CodeIgniter does not utilize GET strings, there is no reason to allow it. Found this is the user guide under http://ellislab.com/codeigniter/user-guide/libraries/input.html; further down on the page they provide methods to grab GET data. My question is, can I access a GET string? Thank you! bs INPUT CLASS destroys global get? - El Forum - 04-07-2009 [eluser]xwero[/eluser] yes CI cleans the GET global but it leaves the SERVER['QUERY_STRING'] alone so all you have to do is Code: $_GET = parse_str($_SERVER['QUERY_STRING']); And then you can even use the CI uri methods afterwards. INPUT CLASS destroys global get? - El Forum - 04-07-2009 [eluser]RJ[/eluser] So it will take: Code: ?Type=whatever&people=model And place into that into Server query string? Any idea if there are string size limitations to this? I am working with an old scripting system and they are transferring data using GET quite a bit. Will try to get away from soon. Thanks INPUT CLASS destroys global get? - El Forum - 04-07-2009 [eluser]xwero[/eluser] yes but you can't use the auto uri_protocol because this will try to process the query string in certain circumstances. INPUT CLASS destroys global get? - El Forum - 04-07-2009 [eluser]RJ[/eluser] I can't auto-load the uri library if i'm trying to access the get string? INPUT CLASS destroys global get? - El Forum - 04-07-2009 [eluser]moodh[/eluser] [quote author="bullspit" date="1239164450"]I can't auto-load the uri library if i'm trying to access the get string?[/quote] The URI library is loaded by default. INPUT CLASS destroys global get? - El Forum - 04-07-2009 [eluser]Colin Williams[/eluser] [quote author="bullspit" date="1239160864"]So it will take: Code: ?Type=whatever&people=model And place into that into Server query string?[/quote] Well, that server variable is available whether or not you use CI. xwero just shows you how to repopulate the $_GET superglobal by parsing this environment variable. INPUT CLASS destroys global get? - El Forum - 04-07-2009 [eluser]xwero[/eluser] Colin thank you for putting my code snippet into context. The SERVER query_string is generated by the sever upon the request that has been received, just like GET but that global puts the query_string in an easier to use array. The parse_str function is like a specialised explode function because it will break the query string like you are used to receive GET and POST input. Oops the use of the parse_str function is wrong, it has to be Code: parse_str($_SERVER['QUERY_STRING'],$_GET); INPUT CLASS destroys global get? - El Forum - 04-10-2009 [eluser]judico[/eluser] Here is my solution to the occasional need to acquire a querystring parameter value from a GET request. Note: $config['enable_query_strings'] = FALSE; in my config.php Code: /** INPUT CLASS destroys global get? - El Forum - 04-10-2009 [eluser]xwero[/eluser] judico doing a preg_match for every value you have to get is more expensive than parsing the query string once and putting it in a variable, it doesn't have to be the get global. |