RE: [PHP] Re: & in Query String
| From: | Chris Shiflett | Date: | Tue, 26 Nov 2002 16:20:00 +0000 |
| Subject: | RE: [PHP] Re: & in Query String | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-126120@lists.php.net to get a copy of this message | ||
--- "Jonathan Rosenberg (Tabby's Place)" <jr@tabbysplace.org> wrote:
> In an earlier message, Derick Rethans [mailto:derick@php.net] said
>
> > Yes it is. Actually, you should specify the URL with the
> > & yourself, like this:
> >
> > <a HREF="show_pic.php?pic=blah&caption=Some+Text">
> >
> > otherwise it is not valid HTML.
>
> I understand that using '&' is technically not correct HTML.
Actually, I think he might have meant XHTML. I'm not sure though.
If your syntax looks like this:
<a href="show_pic.php?pic=blah&caption=Some+Text">
Then your Web browser should interpret the & as an HTML entity
and send a GET request (when you click the link) to:
show_pic.php?pic=blah&caption=Some+Text
Meaning, if show_pic.php receives $_GET["amp;caption"] as someone
else mentioned, the browser has failed.
> But I don't see how changing the '&' -> '&' solves my
> problem.
I think your intuition has served you well. From your initial
description, it sounds like your problm is that you write this:
<a href="show_pic.php?pic=blah&caption=Some+Text">
And the browser sends a GET request to:
show_pic.php?pic=blah&caption=Some+Text
If this is true, this seems like an obvious browser bug to me. I
agree with the other suggestions to beef up the debugging information
you mail yourself, since I'm assuming you can't reproduce this on
your own. Look at all of the $_GET variables, the user agent, and
anything else you can think of.
Oh, I assume your past emails have had timestamps. I would recommend
looking through your Web server's access logs, and see if you can
locate the request that returned an error. See if the URL being
requested has the & in it (which it should not).
> I'm missing something here. If you use '&' to separate
> arguments on the query string, how do they get separated out for
> access via $_GET?
Because you are writing the & in the HTML source code. The
browser should interpret this as & prior to sending the GET request
to the Web server.
Hope that helps.
Chris