include function gives me an error
Posted: Wed Apr 09, 2008 6:20 am
Hello,
I get an error when I'm trying to include a page in my index.php.
My index.php is in:
c:\wamp\www\sigalzcv\xhtml\
The page I'm calling is:
c:\wamp\www\sigalzcv\xhtml\content\work.inc.php
In my index.php I have this code:
<div id="main">
<?php
if (!isset($_REQUEST['content']))
$nextPage = "content/main.inc.php";
else
$nexPage = "content/" . $_REQUEST['content'] . ".inc.php";
include($nextPage);
?>
</div>
When I browse the site, the main page is coming up with no problem, but when I click the button that calls the work.inc.php page, I get this error:
Warning: include() [function.include]: Failed opening '' for inclusion (include_path='.;C:\php5\pear') in C:\wamp\www\sigalzcv\xhtml\index.php on line 24
I checked with echo and the page does get the word "work" as a content.
I also tried to hardcode the path and wrote: include("content/work.inc.php") and got the same error.
Then I tried hardcoding with: "content/main.inc.php" and still got the error.
Any ideas what is wrong?
Thanks,
Cgull
I get an error when I'm trying to include a page in my index.php.
My index.php is in:
c:\wamp\www\sigalzcv\xhtml\
The page I'm calling is:
c:\wamp\www\sigalzcv\xhtml\content\work.inc.php
In my index.php I have this code:
<div id="main">
<?php
if (!isset($_REQUEST['content']))
$nextPage = "content/main.inc.php";
else
$nexPage = "content/" . $_REQUEST['content'] . ".inc.php";
include($nextPage);
?>
</div>
When I browse the site, the main page is coming up with no problem, but when I click the button that calls the work.inc.php page, I get this error:
Warning: include() [function.include]: Failed opening '' for inclusion (include_path='.;C:\php5\pear') in C:\wamp\www\sigalzcv\xhtml\index.php on line 24
I checked with echo and the page does get the word "work" as a content.
I also tried to hardcode the path and wrote: include("content/work.inc.php") and got the same error.
Then I tried hardcoding with: "content/main.inc.php" and still got the error.
Any ideas what is wrong?
Thanks,
Cgull