Welcome Guest, Not a member yet? Register   Sign In
INPUT CLASS destroys global get?
#11

[eluser]judico[/eluser]
noted and very true. I lean on regex's too much sometimes. (in my case I am usually only looking for one value) thanks
#12

[eluser]RJ[/eluser]
[quote author="xwero" date="1239405316"]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.[/quote]

You don't have an example of parsing the query string once do you?

Thanks
#13

[eluser]xwero[/eluser]
see reponse 7
#14

[eluser]pistolPete[/eluser]
[quote author="bullspit" date="1239407178"]You don't have an example of parsing the query string once do you?[/quote]

He posted it above: /forums/viewthread/111036/#560442
#15

[eluser]judico[/eluser]
xwero

for a get request something like http://www.example.com/sample?txt=foo&cat=bar
the sample in cited in #7

Code:
parse_str($_SERVER['QUERY_STRING'],$_GET); #from response #7
print_r($_GET);
yields

Array ( [/sample] => )

whereas something like this

Code:
$keys = explode('?', $_SERVER['REQUEST_URI']);
if(count($keys) == 2){
    print_r(explode('&', $keys[1]));
}

yields

Array ( [0] => txt=foo [1] => cat=bar )

is there something environmental like a config setting that makes your snippet yield something similar?
what's the best practice here for this type of situation?
thanks
#16

[eluser]xwero[/eluser]
it's strange the server query string fetches a path segment? I used the snippet on different servers and i haven't had problems yet.

The uri_protocol shouldn't be auto but i don't see how that could cause the problem as the server global is not related to CI.
#17

[eluser]judico[/eluser]
ok xwero thanks for your reply.

the emergent behavior has to do with url rewriting.

http://www.example.com/index.php/sample?txt=foo&cat=bar
#note the index.php is included on this one

yields

txt=foo&cat=bar

using your method from response #7

I set up url rewrite with this http://codeigniter.com/wiki/mod_rewrite/




Theme © iAndrew 2016 - Forum software by © MyBB