I’ve got this simple question… If you’ve got spaces in the URL $_GET, lets say
"page=about us", and if you then use this code IF($_GET['page']=='about us'). Would that work? Or do you have to use IF($_GET['page']=='about%20us')?
Thanks for your time!
Your browser converts the literal space in URLs into a
+sign – before sending a HTTP request. When PHP sees that very+sign, it will become a space again for$_GET.So, yes, it will work when comparing it against
== "about us". Don’t compare against the%20. (That’s a valid, but unlikely encoding in URLs anyway.)Sidenode. It’s best not to rely on browser magic. When outputting the link, embed the
+in place of spaces yourself.