search engines don't care how you assemble a page. They have no idea if you wrote the whole thing by hand or whether it's all drawn from a database. They do care about what text is actually in the page and what the URL is that was used to fetch it.
Using headers and footers is a little weird, the most obvious one being that your html is split in half with this in the header:
<html>
<body>
<div>
And this in the footer:
</div>
</body>
</html>
As I'm sure you know, it's really easy to have broken html because you don't close all the tags you opened.
There are ways to use a templating engine. The name Smarty Templates comes to mind. Try googling PHP Template Engine.