Re: strange urlencode/decode problem
| From: | Craig | Date: | Wed, 21 Apr 2004 11:40:54 +0000 |
| Subject: | Re: strange urlencode/decode problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-184119@lists.php.net to get a copy of this message | ||
http://ie.php.net/manual/en/function.get-magic-quotes-gpc.php
use stripslashes() :
<?php
echo stripslashes(urldecode($_GET["strSQL"]));
?>
Cheers
"Victor spång arthursson" <scooterbabe@home.se> wrote in message
news:C726776C-9382-11D8-B3C1-00039344A3C4@home.se...
Perhaps I'm tired, perhaps I've missed something obvious, but I can't
get this simple thing which I practically does every week to work
Ok, here is what I do:
<?php
$foo = urlencode("Delete from whatever where ditten = 'datten'");
echo '<a href="foo.php?strSQL=' . $foo . '">Click here to
test</a>';
?>
I sidan foo.php skriver jag:
<?php
echo urldecode($_GET["strSQL"]);
?>
and gets the result:
Delete from whatever where ditten = \'datten\'
The question is why PHP escapes the single qoutes? This has never
happened to me before, except if I have been using addslashes() or
similiar functions
And they occur even if I don't urlencode at all
Why!?!?!?!?
Sincerely
Victor Spång Arthursson - Copenhagen