Pass String Values in a Querystring in PHP

Description

The following code shows how to pass String Values in a Querystring.

Example


//index.php/*from   w  ww .j a v  a 2s. co m*/
<html>
<body>
  <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 />
    <?php
      $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>";
        }
      }
    ?>
  </div>
</body>
</html>




















Home »
  PHP Tutorial »
    Form »




PHP Form
Form Demo