Passing String Values in a Querystring : Query String « Form « PHP

Passing String Values in a Querystring

  <div align="center">
    <p>Click a link to move to a new page:</p>
    <a href="index.php?page=content1.html">Content 1</a><br />
    <a href="index.php?page=content2.html">Content 2</a><br />
    <a href="index.php?page=content3.html">Content 3</a><br />
      $page = trim (urldecode (stripslashes ($_GET['page'])));
      if (isset ($page) && $page != ""){
        if (is_file ($page)){
          require_once ($page);
        } else {
          echo "<p>Sorry, the page you have requested does not exist.</p>";

Related examples in the same category

1.Passing Complex Values in a Querystring
2.Passing Numeric Values in a Querystring
3.parse_str() function parses string into various variables, setting the variables in the current scope.