include statement not working

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
satheshf12000
Forum Commoner
Posts: 25
Joined: Mon Sep 04, 2006 5:38 pm

include statement not working

Post by satheshf12000 »

hi all..

I am using include statement to include("menu.php") in my index page(index.php and menu.php are in the same directory). then i have sports/cricket/cricket.php. when i use include statement like include("/menu.php") in sports/cricket/cricket.php, i am NOT getting the menu. whats wrong with this statement ? but the menu works fine in the index.php page.

thanks..
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

A leading slash in a path indicates an absolute path. In this case PHP will attempt to load menu.php from your server's system root. IF you're a Windows user, root = C:\ or whatever drive letter you happen to be using.
Post Reply