Posted by: Sourav | February 24, 2011

Some examples of encoding in PHP


Page 1(web.php)

<html>
<head>
<title>
Data transfer between two pages
</title>
</head>
<body>
<a href=”web2.php?name=<?php echo urlencode(“Sourav Bhattacharya”)?>&id=600″>Second Page</a>

</body>
</html>

Page2(web2.php)

<html>
<head>
<title>
Data transfer between two pages
</title>
</head>
<body>
<?php
print_r($_GET);
$id=$_GET[‘id’];
$name=$_GET[‘name’];

echo “<br /><strong>”. $id .”:”. $name.”</strong>”;
?>
<?php

$sou1=”Sourav Ghosh”;
echo “<br />”.urlencode($sou1);
echo “<br />”.rawurlencode($sou1);
?>

</body>
</html>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: