learner800 Posted February 13, 2011 Share Posted February 13, 2011 Hello All, I am new to php and programming in general. My question is as follows. I have created a header.inc.php and the index.php which includes header.inc.php. I have title set in header.inc.php under the "head". <title><?php echo $title; ?> In the index.php, I have set variable $title to "Home Page" $title = "Home Page"; But whenever I visit index.php, the title is never called. Is it because the header has no clue where the $title is? Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted February 13, 2011 Share Posted February 13, 2011 The variable must be defined before the point at which it is accessed. Quote Link to comment Share on other sites More sharing options...
learner800 Posted February 13, 2011 Author Share Posted February 13, 2011 Yes thanks I was calling the variable after the header.php inclusion. Simply putting the variable $title before the include solved the issue. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.