How To Protect Special Characters in Query String?

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









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
problems in parsing the xml with the special characters
PHP - Match Special Characters - PHP
query on strings
How can I protect my database password ?
Passing Parameter Values to another jsp in Query Strings
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?
strings
How do I compare strings in Java?
how to get string between two characters
How to Remove Repeated Characters from the String?
strings
strings
Strings
HOW WRITE GREEK CHARACTERS INTO MYSQL BY JSP ?
strings concatnation
ModuleNotFoundError: No module named 'protect'
problem on strings
Protect JSPs from direct access
Java characters
writing characters
password validation with special character
ModuleNotFoundError: No module named 'cn-protect'
ModuleNotFoundError: No module named 'cn-protect'
ModuleNotFoundError: No module named 'protect-rm'
ModuleNotFoundError: No module named 'thrash-protect'
How to Protect against the Penguin Update
How to write Example code for comparing Strings in iPhone SDK?
Iterating the Characters of a String
Character Cases Ignoring case sensitiveness in java
How to create wildcard query in Hibernate?
ModuleNotFoundError: No module named 'characters'
How to insert and retrieve Questions with special symbols and images into database in an ONLINE EXAMINATION project?
how to debug parameters in the hibernate query
ModuleNotFoundError: No module named 'django-csrf-protect-form'
ModuleNotFoundError: No module named 'django-csrf-protect-form'
ModuleNotFoundError: No module named 'Django-Password-Protect'
ModuleNotFoundError: No module named 'trend-app-protect'
ModuleNotFoundError: No module named 'django-csrf-protect-form'

Ads