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.

What I can't figure out is why the '&' got turned into '&amp;'.  Is a
browser doing this?
Yes it is. Actually, you should specify the URL with the &amp; yourself, like this:

<a HREF="show_pic.php?pic=blah&amp;caption=Some+Text">

otherwise it is not valid HTML.


Derick Rethans
PHP Magazine - PHP Magazine for Professionals

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to