@marcdefiant: Take a look at this example:
$variableForHeader = 'HeaderInfo';
The $variableForHeader will not be available in header.php for obvious reasons; it is declared after the header.php file is included.
The echo $variableSetInHeader will work as expected.
It is hard to say anything about what the error could be, when we have no clue about what your code looks like. ;-)