Re: Problems with quotes in URL

From: Date: Wed, 18 Jun 2003 09:18:39 +0000
Subject: Re: Problems with quotes in URL
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-151941@lists.php.net to get a copy of this message
IN a mysql db, I would have a name like :[ whatever "whatever" ] I do a select on the table and then echo the name on a page, as well as add it to a url: page.php?myvar=$myvar where $myvar contains the [ whatever "whatever" ] Now, when I try to echo $myvar on the page.php, I don't get the entire story. I tried to addslashes() before the url line, I tried urlencode() and htmlspecialchars, all causes an echo of $myvar on the page.php page to only display whatever , or, whatever \ but NEVER, whatever "whatever"
What does your link in which 'whatever' is look like ? How do you test to see what is in the variable? This does the job for me: <?PHP if ($_GET['x']=='') {$i='whatever "Whatever"'; echo '<a href="get.php?x='.urlencode($i).'">link</a>'; } else echo 'x is '.urldecode($_GET['x']); ?> and the url looks like:http://www.XXXXX.nl/get.php?x=whatever+%22Whatever%22

« previous php.general (#151941) next »