Actually, it sounds like you're right on track.
Imagine you have 10 (or even 10,000) pages and you want them all to have the same header. It doesn't matter how simple or complex the HTML code is. It doesn't matter if the header is as simple as <h1>This is my header</h1> or as complex as 100 lines of PHP and a dozen <div> tags. Whatever code you want to appear on every page, save that code into a text file called header.php. Then on each of your pages (index.php, faq.php, contact_us.php, etc) write this line: <?php include("header.php"); ?>
You can put PHP code inside header.php and it will get executed too.
That's lesson one. As you get more skill, you will find all sorts of cool ways to modify that model but what you see above is a good place to start.
Lesson 2 starts with wanting the header to be basically the same on every page but not exactly the same. For example, I often do something like this:
I make my header.php (with lots of HTML and PHP in it) and I include a line that says:
<html><head>
<title><?php print "$title"; ?></title>
</head>
<body><center><h1><?php print "$title"; ?></h1></center>
Then, in my FAQ page, I might do something like this:
<?php
$title="FAQ page";
include ("header.php");
?>
And the contact us page looks similar:
<?php
$title="Contact Us page";
include ("header.php");
?>
This way, The header has the same basic format on every page BUT it's slightly modified everytime it gets displayed on a page.
Lesson 3 puts conditionals in the header. For example, imagine that you have 10,000 pages and half of them should have a header with a graphic and the other half don't. Your header.php might look like this:
<html><head>
<title><?php print "$title"; ?></title>
</head>
<body>
<?php
if ($header_type=="without_graphic") {
?>
<center><h1><?php print "$title"; ?></h1></center>
<?php
}
else {
?>
<center><img src="<?php print "$graphic_filename"; ?>"></center>
<?php
}
?>
Now when you include that header, you set $header_type to "with_graphic" or "without_graphic". And when you set it to "with", then you also need to set the $graphic_filename variable.
Maybe that's more complex than you were asking about... but all of these are good examples of how to include common code, style, and format on every page, even if they're not identical on every page.