MichelLSZ
asked on
Special character (+) gets lost when transmitted as GET parameter
Hi!
I have to process URLs having + characters and blanks in their GET parameter. Unfortunately, PHP is replacing the + characters by blanks. By the way, I access the GET parameters using $_GET[parameter].
Is there a way to prevent PHP from converting + characters in a URL to blanks?
Thanks a lot.
Michel
I have to process URLs having + characters and blanks in their GET parameter. Unfortunately, PHP is replacing the + characters by blanks. By the way, I access the GET parameters using $_GET[parameter].
Is there a way to prevent PHP from converting + characters in a URL to blanks?
Thanks a lot.
Michel
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
urencode as u've seen in php manual, converts special characters by % and two hex digits. If it is vital for you to get all the special characters in your GET, then u got to use URL encode. but if u r planning to use GET with "id" or "pageNum" or numrical stuff like that, your don't have to use it !!!
ASKER
Since I have + characters in my GET parameters I need to use urlencode(). Otherwise they are lost.
Thanks a lot for your help.
Michel
Thanks a lot for your help.
Michel
ASKER
At least for preperation of references, like:
<?php
echo "<a href=\"test.php?id=" . urlencode($id) . "\">";
?>
or when using JavaScript:
location.href="test.php?id
Michel