Running my site through http://validator.w3.org/check, I get a lot of error messages saying that my links should use &
in stead of &
.
So I updated my code, only to find out that $_GET
does not like this.
My URL was this: www.mysite.com/?foo=1&bar=2
and I changed it to this: www.mysite.com/?foo=1&bar=2
The problem is that doing a print_r($_REQUEST)
gives me this result:
Array ( [foo] => 1 [amp;storeid] => 2 )
Why doesn't $_GET
, $_POST
and $_REQUEST
recognize the &
?
UPDATE
This is one of the ways I generate a URL:
$url = get_bloginfo('url')."/?foo=".$element['name']."&bar=".$element['id'];
$link = '<a href="'.$url.'" title="'.$element['name'].'">'.$element['name'].'</a>';
&
is the HTML entity reference for &
. URL parameters are still separated by a single &
, but if you mention the URL in HTML, you need to encode it. For
<img src="img?width=100&height=100" />
the browser then requests img?width=100&height=100
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With