In IE: my CSS has been changed while using a mysql based SESSION with php


This has been stumping me all day. I'm using a mysql based SESSION on my php file. All of the other browsers, except IE, are displaying my pages with the appropriate CSS files and they look fine (more specifically, it is changing my hover effects on my menu and changing the alignment of my footer). I've tested the file without the SESSION code in IE and it works fine. What is causing IE to change my layout when the SESSION is added?? Very frustrated. I'm sure you can tell I'm a php beginner from this message. Please help. Thank you. James

 if(@$_SESSION['auth'] != yes)
echo "<center><a href='logOut.php'>Log Out</a></center>\n";
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" ""> 
<html xmlns="" xml:lang="en-GB"> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 

Bagelmania | bagels and spreads | delicious coffee | sandwiches

<link rel="shortcut icon" href="bm.ico"> 
<link rel="stylesheet" type="text/css" href=""/>
<link rel="stylesheet" type="text/css" href=""/>
<link rel="stylesheet" type="text/css" href=""/>


 <div id="topFade"></div>
  <div id="banner">
  <div id="bannerContainer"> 
   <div id="bannerContent">
<div id="bannerFlower"> 
             <!-- END BannerFlower --> 
    <div id="bannerPar">
    </div> <!-- END bannerPar -->

  </div><!-- END bannerContent -->
 </div><!-- END bannerContainer -->
</div><!-- END banner -->

<div id="menuWrapper"> 
<div id="menuContainer"> 
  <div id="centeredmenu"> 

       -Affiliate Marketing


  </div>   <!-- END centeredmenu --> 
 </div>   <!-- END menuContainer --> 

</div>  <!-- END menuWrapper --> 

<div id="wrapper">
  <div id="container">
Problem courtesy of: James30


The reason is probably that you are outputting HTML before you are declaring the doctype. That causes IE to switch to quirks mode.

Solution: Move this line

echo "<center><a href='logOut.php'>Log Out</a></center>\n";

into the HTML document.

Solution courtesy of: Pekka 웃


There is currently no discussion for this recipe.

This recipe can be found in it's original form on Stack Over Flow.