How To Protect Special Characters in Query String?
Hi all,
For this purpose you can urlencode() translation function.
Example :
<?php $string = "This is deepak."; $url = "my.php?data=" . urlencode($string); print "<a href=\"$url\">Just Click</a><br>"; if (isset($_REQUEST["data"])) { print "URL IS : " . $_SERVER['REQUEST_URI'] . "<br>"; print "Decoded data is : " . urldecode($_REQUEST["data"]); } ?>
The output :
Just Click URL IS : /my.php?data=This+is+deepak+. Decoded data is : This is deepak.
Thanks
Ads