You are here: Re: [PHP] URL encode « PHP « IT news, forums, messages
Re: [PHP] URL encode

Posted by Jochem Maas on 02/23/05 18:01

Bruno Santos wrote:
> Hello.
>
> Im having some trouble when getting a query from a $_GET method
>
> the problem is, when using $_GET, i get some charaters decoded as html
> entities.
>
> if i submit the word %sara% (example), is ok
> but, if i submi the word %carlos%, i get Êrlos, witch is the translation
> of html entity %ca

so a user is entering '%carlos%'?

firstly it _looks_ like you are adding the '%' signs in order to
have this affect the way a search query is performed - if this is the case
maybe you should consider wrapping the search term on the server side _after_
you have recieved the string?

also if you run the following:

echo urlencode("%carlos%");

you will see that in order to pass the '%' sign in a url it will need to be encoded
as '%25'; if you create the string '%carlos%' on the server then you can perform
urlencode() on it before outputting the url and it should come back as you expect...
if on the otherhand this is user entered info then you may need to use javascript
to encode the string before the forms values are submitted.

>
> how can i can resolve it ??
>
> ive tryed with htmlentities, urlencode, urldecode, etc...

you don't need to run any function over the incoming value - the webserver
will urldecode what ever GET string is incoming... if the string is not properly encoded
in the first place (i.e. before it is used as a request to the webserver) then
there is no proper way of retrieving the original value AFAICS

> help ?
> cheers
>
> Bruno Santos
>

 

Navigation:

[Reply to this 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

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