Reply to Re: urlencode and $_GET

Your name:

Reply:


Posted by Jerry Stuckle on 11/17/05 20:49

meltedown wrote:
> Jerry Stuckle wrote:
>
>> Can you post your code?
>>
>> I've encoded a '#' before with no problems at all.
>>
> Thanks for telling me that. Apparently, this not a common problem but
> something wrong with my code. After you told me that, I did this simple
> example.
>
> http://reenie.org/test/test16.php?value=start%23end
> After you hit the link, it says
> $_GET is:Array ( [value] => start#end )
> #end is not missing, so it works fine
>
> Here's the code for the example
> echo "\$_GET is:";
> print_r($_GET);
> echo "<br>\n";
> $value="start#end";
> echo "value is:$value<br>\n";
> $value=urlencode($value);
> echo "value after urlencode is:$value<br>\n";
> echo "<a href='?value=".$value."'>test link</a>";
>
> I'm still trying to figure out how to make an example of the original
> problem.

Yes, it looks like it's doing exactly what it's supposed to do.

I suspect a logic problem in your code. Look at the URL in your browser
bar in your original code. It should have something like:

http://www.example.com?value=start%23end

If instead of the "%23" you have a "#", the problem is you didn't get it
encoded properly. OTOH, if it you have something like "?value=" or
"?value=start" you probably didn't get the string concatenated properly.

You can also look at the HTML source for the page you're linking from.
There you should see:

<a href="http://www.example.com/testpage?value=start%23end">test link</a>

These things can be difficult to find sometimes!

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация