|
Posted by Jerry Stuckle on 03/20/07 04:12
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?
>
> Thanks for the help!
>
> Chad
>
Chad,
First of all, it's urlencode() - not encodeURI(). I have no idea what
that function does - it's not part of the PHP standard library.
And you're using AJAX - which is something completely different. Not
being an AJAX user myself, I can't say what your problem is. All I know
is I use urlencode() with some regularity and it works fine. I've also
tried strings with a '#' in them and it's OK.
The '#' is used in an href to indicate a tag (<a name=...>) on a page.
Perhaps AJAX is getting confused. I wouldn't know. Or maybe your
encodeURI() function isn't doing the same thing.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Navigation:
[Reply to this message]
|