You are here: Re: How to use escape characters (particularly #) with $_GET « PHP Programming Language « IT news, forums, messages
Re: How to use escape characters (particularly #) with $_GET

Posted by Erwin Moller on 03/20/07 16:20

chad.a.morris@gmail.com wrote:

> On Mar 19, 8:45 pm, Jerry Stuckle <jstuck...@attglobal.net> wrote:
>> chad.a.mor...@gmail.com wrote:
>> > I don't have a lot of experience using $_GET.
>>
>> > I need to know how to pass characters in using the $_GET method. The
>> > character I'm having a problem with right now is '#', but I'm sure
>> > there are others.
>>
>> > Could anyone give me a list of characters that need to be escaped
>> > using $_GET, and then also how to use them?
>>
>> > Also, could you tell me if any characters simply are not allowed in a
>> > get?
>>
>> > Example:
>>
>> > getData.php?type=edit&user=myName&item=Item#1
>>
>> > Thanks,
>>
>> > Chad
>>
>> urlencode() your parameters.
>>
>> --
>> ==================
>> Remove the "x" from my email address
>> Jerry Stuckle
>> JDS Computer Training Corp.
>> jstuck...@attglobal.net
>> ==================- Hide quoted text -
>>
>> - Show quoted text -
>
> I'm trying to go from javascript (making the call) to php.
>
> For example:
>
> function getData()
> {
> var user = "user1" ;
> var item = encodeURI( "Item #1" ) ;
> xmlHttp.open( 'GET' , 'addData.php?user=' + user + '&item=' +
> item ) ;
> }
>
>
> However, the encodeURI() function on the string give returns the
> following:
>
> Item%20#1
>
> So, it is leaving the pound sign, which is messing me up.
>
> Any other thoughts? Perhaps I'm not using the functions correctly?

Indeed.

encodeURI leaves ; / ? : @ & = + $ , # all intact.

What you need in Javascript is escape(), not encodeURI().

Tip: Buy a good JS book and you never fall for this kind of thing again.
I recommend Javascript, the definitive guide, by Flanagan (O Reilly)

Regards,
Erwin Moller

>
> Chad

 

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

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