Hello friends, this is my 12th tutorial of PHP and Today I am sharing the concept of URL encoding in PHP. Every user needs data privacy so whenever you are passing data over URL you should encode it properly so that I can be saved from some beginning level threads. URL encoding is used for this purpose, with it's help you can encode the data that you are passing over the network. Let us consider the following example :
 <?php  
$list=" & go to second page";
?>
<a href="secondpage.php?id=1&name=<?php  echo urlencode("santosh&&"); ?>">Second Page</a>
<a href="secondpage.php?id=1&name=<?php  echo urlencode("santosh&&"); ?>"><?php  echo htmlspecialchars($list); ?></a>
As you can see in the above example we have encoded the data that we are passing through the URL.

0 comments:

Post a Comment

Note: only a member of this blog may post a comment.