Hi,
I have a site where each page is made up of 3 pages. i.e. header.php, then the proper page, like index.php or links.php etc and then footer.php at the end. I am trying to program a mood selector, where u select what mood your in, and it displays the site in different colours. This works ok for tables located in the main pages, and footer.php, but not for tables in the header, they seem to leave out the colours for some reason. My pages look basically like this..
#header.php
include($DOCUMENT_ROOT.'/include/database.php');
if ($submit) {
if (colour == "blue")
{
$bgcolor = "blue";
$linkcolor = "blue";
} else if (colour == "red")
{
$bgcolor = "red";
$linkcolor = "red";
} else if (colour == "green")
{
$bgcolor = "green";
$linkcolor = "green";
}
}
function site_header($title) {
echo "
<head>
<title>$title</title>"
?>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor="<?echo "$bgcolor";?>">
<div align="center">Table Contents....</div>
</td>
</tr>
</table>
<?
}
function site_footer() {
}
?>
#mainpage.php
include($DOCUMENT_ROOT.'/include/header.php');
site_header('Website Title');
?>
echo '<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor="'.$bgcolor.'">
<div align="center">This is where the main page contents go...</div>
</td>
</tr>
</table>';
include($DOCUMENT_ROOT.'/include/footer.php');
site_footer();
#footer.php
echo '<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor="'.$bgcolor.'">
<div align="center">Copyright 2002 etc...</div>
</td>
</tr>
</table>
</body>
';
So the table bacground colours work on the main pages, and the footer, but not in the header. Can anyone see why?
Regards
Ben