Question:

PHP Page Storage!!! Please Help!!?

by  |  earlier

0 LIKES UnLike

If I created a PHP page called error.php, if I add the following parameters to the url error.php?errcode=404 how would I make it display something else- still remaining completely independant of itself (no other files involved).

If you cant answer this, how about this:

How would I make a page display dynamically, like dyna.php?title=untitled&header=unknownhe... would make the contents of the parameters appear on the page, thanks.

 Tags:

   Report

2 ANSWERS


  1. if(!empty($_GET['errcode'])){

       echo "<h1>".$_GET['errcode']." - Error</h1>";

    }

    else{

       echo "<h1>Normal Page Contents</h1>";

    }

    This would display the page normally if no error code is set, but would display the error code if it is set, you can also change the error code


  2. put this in dyna.php:

    <html>

    <head>

      <title><?php echo $_GET["title"] ?></title>

    </head>

    <body>

    <?php echo $_GET["contents"] ?>

    </body>

    </html>

    Then go to dyna.php?title=This is an example title&contents=<h1>This is the contents of my site!</h1>

Question Stats

Latest activity: earlier.
This question has 2 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.