RE: [PHP] Re: & in Query String

From: Date: Tue, 26 Nov 2002 16:06:07 +0000
Subject: RE: [PHP] Re: & in Query String
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-126114@lists.php.net to get a copy of this message
Not, this answer makes sense. I couldn't see how using '&amp;' 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:erwin@isiz.com] > Sent: Tuesday, November 26, 2002 10:54 AM > To: php-general@lists.php.net > Subject: [PHP] Re: &amp; 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 >

« previous php.general (#126114) next »