PDA

View Full Version : php undelcared variable in url



ngubie
16 Aug 2006, 12:41 PM
hi, i'm trying to pass a variable through the url of my index.php to load other sections of my page.
until now i've been keeping like half a dozen pages like 'template_news.php' which each include a 'content_news.php' page. but i'm trying to clean things up by having the index pass a variable through a link to the contents

in the links section of my index.php i have my links set up with
<a href="index.php?section=news">

and in the content section of the index i have the
<?php include($section.'.php');?> statement

but it's giving me a Undefined variable: error
i can see the "index.php?section=news" in my url bar, so that means its being passed, but the page itself doesnt detect the variable.

its a simple task, but i'm stuck. has anybody had this problem before? are there restrictions on how to use this that im not aware of?