JoeBlood Posted April 20, 2011 Share Posted April 20, 2011 Hi All, I'm pretty new to web development, and playing with some php. Scenario: I have a separate 'header.php' file, which displays among other things the page title, aka <td><?php echo $pagetitle; ?></td> whenever it is invoked by each page. Then each page invokes the header by: <?php $pagetitle="Whatever"; include('includes/header.php'); ?> But when I load the page, either an error message (within the header) yells about the undefined variable 'pagetitle', (although I defined it in the calling page), or if I turn the error off it displays no text at all. How do I pass this page title variable to the header file when it is called? Or better still, how can 'header.php' determine the calling page title automatically and display it accordingly? Thank you! JB Quote Link to comment https://forums.phpfreaks.com/topic/234242-question-of-logic/ Share on other sites More sharing options...
JoeBlood Posted April 20, 2011 Author Share Posted April 20, 2011 Please disregard, it did work OK, I was just viewing the wrong page. Quote Link to comment https://forums.phpfreaks.com/topic/234242-question-of-logic/#findComment-1203936 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.