Folks,

PHP newbie here...I'm writing a simple page that dynamically changes an
included file based on the query string:

<?php
    //error_reporting(0);
    $content = $_GET['content']; // line 3
    if ($content == NULL) {  // if no querystring or querystring doesn't
contain 'content=foo'
        $content = "content/home.php";
    } else {
        $content = "content/" . $content . ".php";
    }
?>

<body>
    <?php include($content); ?>
</body>

When the URL is "index.php?content=foo" all is fine.  When I try
"index.php", I get the following error message:

"Notice: Undefined index: content in C:\\Apache2\htdocs\index.php on line 3"
(doesn't like index 'content' in $_GET['content'])

If I uncomment 'error_report(0)', the notice is ignored (but I don't really
want to do that) and page renders fine with 'index.php'.  Is this the only
way?

Thanks...rich



-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to