CodeIgniter Forums
uri_to_assoc issue - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: uri_to_assoc issue (/showthread.php?tid=22413)



uri_to_assoc issue - El Forum - 09-08-2009

[eluser]neomech[/eluser]
Hi there,

I'm passing a url-encoded piece of information into my controller, and I'm having trouble using uri_to_assoc to access it, which has me confused.

My code looks like this:

Code:
$var=$this->uri->uri_to_assoc(1,$url_data);

If my url is www.mysite.com/controller/method/filter/brandToyota, then I'm properly getting an array $var('filter'=>'brandToyota').

What I'm trying to do though is get my filter data in a format that's a little more easy to read, particularly as I'll have multiple filters applied in some cases and I don't want to use querystrings. So I'm trying to pass brand=Toyota, although url-encoded of course.

Why doesn't this work?

Quote:www.mysite.com/controller/method/filter/brand=Toyota

(errr...I don't know how to display that properly in the forums....there's a %,3,D (with no commas) between brand & Toyota in the url, not an equals sign)

In this case uri_to_assoc is only returning "brand"....I get an array $var('filter'=>'brand'), which obviously doesn't work for me.

I would have thought the "url safe" characters wouldn't have any effect on uri_to_assoc. In any case, any ideas how to get around this?

Thanks for any help!


uri_to_assoc issue - El Forum - 09-08-2009

[eluser]neomech[/eluser]
Ahh....think I figured it out...% 3 D (the url encoded value for the equals sign) is in the $bad array in the input.php class.

My noobishness has me wondering why a url-encoded equals sign is bad...can someone please explain that to me? I think I understand why a regular old equals sign would be bad, but I would have thought a url-encoded one would be pretty safe.

I'm thinking of commenting out that little line from the $bad array and want to know if that's a phenomenally bad idea! Smile