suttercain Posted August 20, 2008 Share Posted August 20, 2008 Hi everyone, I currentley have a string which is "CA/ECS/2004/PM3+/N00/OFF/DPF03" and it is passed using the $_GET method. I can see the string CA/ECS/2004/PM3+/N00/OFF/DPF03 in the URL browser fine, but when I echo it, the plus sign is dropped and replaced with whitspace so it now reads: CA/ECS/2004/PM3 /N00/OFF/DPF03. I tried urlencode() but that didn't help. Is there a reason the plus sign is not showing up and is there a fix? Thanks. Link to comment https://forums.phpfreaks.com/topic/120538-solved-why-is-a-character-being-dropped-from-the-string/ Share on other sites More sharing options...
MatthewJ Posted August 20, 2008 Share Posted August 20, 2008 Not sure how you correct it, but would assume it is because in URL's spaces are either replaced with %20 or + so it thinks you are just filling in the space. Link to comment https://forums.phpfreaks.com/topic/120538-solved-why-is-a-character-being-dropped-from-the-string/#findComment-621138 Share on other sites More sharing options...
suttercain Posted August 20, 2008 Author Share Posted August 20, 2008 yeah that's the weird thing though, I can see the + in the URL of the browser but when I print_r($_GET) it replaces it with white space, which then affects the search. Link to comment https://forums.phpfreaks.com/topic/120538-solved-why-is-a-character-being-dropped-from-the-string/#findComment-621139 Share on other sites More sharing options...
suttercain Posted August 20, 2008 Author Share Posted August 20, 2008 If anyone has quick access to wamp or something can you try passing a plus sign using the $_GET method and see if you too get white space? Link to comment https://forums.phpfreaks.com/topic/120538-solved-why-is-a-character-being-dropped-from-the-string/#findComment-621142 Share on other sites More sharing options...
MatthewJ Posted August 20, 2008 Share Posted August 20, 2008 you just need to replace the + with %2b and it will work fine... Link to comment https://forums.phpfreaks.com/topic/120538-solved-why-is-a-character-being-dropped-from-the-string/#findComment-621147 Share on other sites More sharing options...
suttercain Posted August 20, 2008 Author Share Posted August 20, 2008 Okay, I got it, I use urlencode and without decoding it, it seems to work fine. Link to comment https://forums.phpfreaks.com/topic/120538-solved-why-is-a-character-being-dropped-from-the-string/#findComment-621149 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.