URL Multiple Query Parameters Encoded with HTML Entities
I came across a situation where a URL with multiple query parameters was encoded using htmlentities() and PHP was not recognizing the query parameters using $_GET. A common case for encoding urls using htmlentities() is to use them inside XML documents.
So a url with multiple query parameters, encoded using htmlentities() would look like this:
http://www.bradino.com/?color=white&size=medium&quantity=3
and when that url is accessed the second and third query parameters are not recognized because instead of separating the subsequent variables with an & that character gets converted into &. I could not find a good way to resolve this, so basically I just encoded the query string back to normal using html_entity_decode() and then slammed the parameters back into the $_GET array using parse_str().
There must be a better way! Anyone come across this before?
You’re currently reading “ URL Multiple Query Parameters Encoded with HTML Entities ,” an entry on BRADINO
- Published:
- 9.11.09 / 5pm
- Category:
- PHP























damn, yeah, this is annoying…just went through the same thing… really don’t like the whole parse_str on the other side….