The original string is: This string, is long, has spaces, a +, commas & an ampersand.
The encoded string is: This+string%2C+is+long%2C+has+spaces%2C+a+%2B%2C+commas+%26+an+ampersand.
Test Link:: Sample5.2
Press the test link to run the test!

The source of this page was:
<?php

$str="This string, is long, has spaces, a +, commas & an ampersand.";
$encoded=urlencode($str);

echo "<b>The original string is:</b> ".$str;
echo "<br><b>The encoded string is:</b> ".$encoded;

echo "<br><b>Test Link::</b> <a href=sample5_2.html?varOne=$encoded>Sample5.2</a>";

if ($varOne=="") {
  echo "<br><b>Press the test link to run the test!</b>";
} else {
  echo "<br><b>The string passed to PHP is:</b> ".$varOne;
}
?>
Call this code with the link Sample 5.2

Back to Lesson 5