strange urlencode/decode problem
| From: | Victor Spång Arthursson | Date: | Wed, 21 Apr 2004 10:58:10 +0000 |
| Subject: | strange urlencode/decode problem | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-184116@lists.php.net to get a copy of this message | ||
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