How To Protect Special Characters in Query String?

Ads
 

How To Protect Special Characters in Query String?

How To Protect Special Characters in Query String?

View Answers

November 15, 2010 at 1:00 PM

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









Related Tutorials/Questions & Answers:
How To Protect Special Characters in Query String?
Protect Special Characters.
Advertisements
How to avoid the Special characters? - JDBC
special characters in my HTML
special characters in my HTML
regular expression for special characters
replace special characters in html
remove special characters iphone
Escaping Special Characters in a Pattern
query on strings
problems in parsing the xml with the special characters
PHP - Match Special Characters - PHP
How can I protect my database password ?
Passing Parameter Values to another jsp in Query Strings
How do I compare strings in Java?
Concatenate Two Strings in java
Character Comparison Example
how can i remove newline characters and tabs
How to find the first 6 characters of string in regex?
How to Remove Repeated Characters from the String?
how to get string between two characters
strings
strings
strings
Strings
HOW WRITE GREEK CHARACTERS INTO MYSQL BY JSP ?
Protect JSPs from direct access
How to Protect against the Penguin Update
strings concatnation
How to create wildcard query in Hibernate?
how to debug parameters in the hibernate query

Ads