Not, this answer makes sense.  I couldn't see how using '&' in the query
string would work.

I'm gonna take the advice & augment my error message to include browser name
& other info.  I've been wondering if a web crawler might be causing this.

I'll let you know what turns up (of course, the problem will stop occurring
once I add this info :-).

--
JR

> -----Original Message-----
> From: Erwin [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, November 26, 2002 10:54 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Re: & in Query String
>
>
> Derick Rethans wrote:
> > Jonathan Rosenberg wrote:
> >> I have a page with thumbnail pictures that can be clicked on to see
> >> a larger picture.  Each picture is hyperlinked as follows
> >>
> >> <a HREF="show_pic.php?pic=blah&caption=Some+Text">
> >>
> >> I access the 'pic' & 'caption' attributes with $_GET['pic'], etc.
> >> Pretty standard stuff.
> >>
> >> I have PHP set up so that error messages get mailed to a specified
> >> mail account.  Every so often I get the following error message:
> >>
> >> Undefined index:  caption
> >> In file /home/..../show_pic.php, line 64
> >> page: /show_pic.php?pic=gb3.jpg&amp;caption=Some+Text
> >>
> >> The problem is obviously (I think) that the $_GET['caption'] is
> >> failing.
>
> True, if you receive &amp;caption in your URL, then the variable won't be
> called $_GET['caption'], but $_GET['amp;caption'], which (I think) is
> invalid because of the ;.
>
> >>
> >> What I can't figure out is why the '&' got turned into '&amp;'.  Is a
> >> browser doing this?
>
> > Yes it is.
>
> No, it isn't. I sure hope there is no browser which turns & in &amp; in
> URL's. That would be very, very bad indeed!
>
> > Actually, you should specify the URL with the &amp;
> > yourself, like this:
> >
> > <a HREF="show_pic.php?pic=blah&amp;caption=Some+Text">
>
> Of course not...this is a HREF tag, which can use & instead of
> &amp;. &amp;
> is for displaying purposes only, not for URL's.
>
> Following the tip from Marek, adjust your errormessage mailing
> thingy...add
> all the $_GET variables to it (print_r($_GET)). Some other notices maybe
> usefull to...
>
> Erwin
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to