I’m having a problem that’s probably (hopefully) very easy to solve but I’m just about stuck.
When I use the urlencode (or rawurlencode) function it will not find he script I’m sending it too.
So this works fine:
$data["text"] .= "<a href='index.php?load=results®=".$row["region"]."'>".$row["region"]."</a><br/>";
And it will take me to the correct page:
index.php?load=results®=CRO
But the person I’m doing the job is having her “&” symbol replaced with a (R) registered symbol, and she is getting a page not found. Unfortunately I’m unable to reproduce this on any of the other computers in this office
So when i change the code to read
$data["text"] .= "<a href='".urlencode("index.php?load=results®=".$row["region"])."'>".$row["region"]."</a><br/>";
It tries to take me to this page
index.php%3Fload%3Dresults%26reg%3DCRO
But it gives me the following page not found error:
The requested URL index.php?load=results®=CRO was not found on this server.
Which is really weird because the requested URL is exactly the same as the URL which resolves no bother up the top. I understand I’ll need to run urldecode (or rawurldecode) at some stage but if it isn’t even finding a script to load I can’t run that function anyway…
EDIT: Further details – I am coding on a Mac using TextWranger. The file is encoded using utf8 with Unix (LF) Line Endings. The local server is using MAMP and the live server is a Windows based machine but I’m not sure of any configuration settings that could help as I’ve just started here. The output HTML is encoded with UTF-8.
Here is how you use it:
What you are doing is urlencoding the values of you parameters, not the whole query.
So basically: