[thelist] PHP encoding &s in a URL
fstorr
fffrancis at fstorr.demon.co.uk
Mon Sep 1 14:55:47 CDT 2003
Matt King wrote:
> urlencode it for the URL, then take the querystring value and urldecode it
> before you use it in your SQL query...
++++
Hi
Okay, 2 replies saying encode, looks like I was nearly there. This is
probably obvious, but why doesn't this code work? It's just these lines
that I've tested this on this evening - the actual page is at work. The
page refers back onto itself - all I get is the D and not the D%26T.
<a href="encode.php?q=d&t">D&T</a>
<?
$somevar = urlencode($_GET['q']);
echo "somevar equals " .$somevar;
?>
More information about the thelist
mailing list