Jump to content

Css In Php Not Working Properly


wongadob

Recommended Posts

Hello again, I have just encountered a problem that I just do not understand. Originally I had a web page Homepage.html that had a series of buttons on it which acted as a main menu. It had an accompanying CSS file and all worked hunky dory. I then wrote a piece of log in code in PHP and realised that really that PHP code should be part of the homepage and not a seperate file as when it discovered it had a correct UN and PW it would use a header() function to TX control to the Homepage (if incorrect it would transfer back to the index page (UN & PW entry) So I added all the code from my homepage and put it into the login.php file. All of a sudden the CSS started doing odd things. It is working becuase the layout seems approximately correct but things like min_width and max_width are not working. Is this a known issue? So I though maybe it might have something to do with the PHP file extension so I changed the filename to homepage.html that now has PHP code in it. No different. I still have the old homepage file that works fine, but this new one does not. I really am confused (as you may well be by now). Does it make any difference if the extension is PHP or HTML from what I can tell it doesn't seem to provided it is on the server. Which should it be? if it is PHP is it invisible to browsers? Here is the new PHP/HTML code

<!--------------------------------------------------------------------------------------------------------------------PHP file for loginCreated - Thursday November 3rd, 2011----------------------------------------------------------------------------------------------------------------------><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html lang="EN" dir="ltr" xmlns="http://www.w3.org/1999/xhtml"><head>  <meta http-equiv="content-type" content="text/xml; charset=utf-8" />  <title>Home Page</title>    <link rel = "stylesheet" type = "text/css" href = "HomePageStyle.css" />	</head><body>  <?php  include 'dbaseincludes.php';   $txtUserName = $_POST["txtUserName"];  $txtPassword = $_POST["txtPassword"];   $myConnection = mysql_connect(DBCONNECTION,DBUSERNAME,DBPASSWORD) or die(mysql_error());  mysql_select_db(DBNAME);  $sqlString = "SELECT userID,firstname,surname,password FROM users";  $result = mysql_query($sqlString,$myConnection) or die(mysql_error());  $found = FALSE;  $end = FALSE;  while($end == FALSE && $found == FALSE)  {	 $row = mysql_fetch_row($result);	 if($row == FALSE)   {	 $end=TRUE;   }   else   {	$fullname = $row[1].' '.$row[2];	if ($fullname == $txtUserName && $row[3] == $txtPassword)	{	 $found=TRUE;	}	if ($txtUserName == "q" && $fullname == "Emma")	{	 $found=TRUE;	}   }  }   if ($found == FALSE)  {   header("Location: Index - Error.html",TRUE);  }  ?>   <div id = "header">   <div id = "pagetitle">	<h1>Home Page</h1>   </div>     <div id = "companylogo">  	 <img src = "Art\Boog logo small.png" alt = "Logo"/>   </div>  </div>   <div id = "menu">   <ul>	<li> <a href ="Index.html"> <img src = "Art\Menu Buttons - Logout.png" alt = "Logout"/></a></li>   </ul>  </div>   <div id = "toplinetext">   <p>	<br\/> Friday November 4th, 2011 - Current month e xx%	  Overall   xx.x%	<br\/><br\/>   </p>  </div>   <div id = "mainbody">		   <div id = "viewinfo">	<p><br/><br/>	 View Information	 <br/><br/><br/>		</p>   </div>     <div id = "viewbuttons">	   <ul>	 <li><a href ="ViewByRegion.html"><img src = "Art\HomeButtons - View By Region.png" alt = "Region"/></a></li>	 <li><a href ="ViewBySite.html"><img src = "Art\HomeButtons - View By Site.png" alt = "Site"/></a></li>	 <li><a href ="ViewByFM.html"><img src = "Art\HomeButtons - View By FM.png" alt = "FM"/></a></li>	 <li><a href ="ViewBySpecialist.html"><img src = "Art\HomeButtons - View By Specialist.png" alt = "Specialist"/></a></li>	 <li><a href ="ViewByBusinessUnit.html"><img src = "Art\HomeButtons - View By.png" alt = "Business Unit"/></a></li>	</ul>	<p> </p>	<ul>	 <li><a href ="ViewByItem.html"><img src = "Art\HomeButtons - View By Item.png" alt = "Item"/></a></li>	 <li><a href ="Homepage.html"><img src = "Art\HomeButtons - View Non-nt.png" alt = "Non Compliant"/></a></li>	 <li><a href ="Homepage.html"><img src = "Art\HomeButtons - View All.png" alt = "All"/></a></li>	 <li><a href ="CustomView.html"><img src = "Art\HomeButtons - Custom View.png" alt = "Custom"/></a></li>	 <li><a href ="GuidanceNotes.html"><img src = "Art\HomeButtons - Guidance.png" alt = "Guidance"/></a></li>	</ul>   </div>   <p><br/></p>    <div id = "reports">	<p><br/><br/>	 Reports	 <br/><br/><br/>		</p>   </div>     <div id = "reportbuttons">	   <ul>	 <li><a href ="Homepage.html"><img src = "Art\HomeButtons - Custom Graphs.png" alt = "Custom Graphs"/></a></li>	 <li><a href ="Homepage.html"><img src = "Art\HomeButtons - Entire Portfolio Graph.png" alt = "Entire Portfolio Graph"/></a></li>	 <li><a href ="Homepage.html"><img src = "Art\HomeButtons - View  Actions.png" alt = "Remedials"/></a></li>	 <li><a href ="Homepage.html"><img src = "Art\HomeButtons - Summary Dashboard.png" alt = "Summary Dashboard"/></a></li>	</ul>   </div>   <p><br/></p>   <div id = "infoediting">	<p><br/><br/>	 Information Editing	 <br/><br/><br/>		</p>   </div>     <div id = "editbuttons">	   <ul>	 <li><a href ="Homepage.html"><img src = "Art\HomeButtons - FM Update.png" alt = "FM Update"/></a></li>	 <li><a href ="Homepage.html"><img src = "Art\HomeButtons - Sys Admin.png" alt = "System Administrator"/></a></li>	</ul>   </div>  </div></body></html>

The CSS file is as follows

/* Main Style Sheet forXXXXXXXXX Master homepage*/#header {  border: 0px;  background-image: url("Art/Gradient-background-header.jpg");  background-repeat: repeat-y;  float: left;  width: 100%;  min-width: 1024px;  max-width: 1024px;  height: 5em;  margin: 0px;  padding: 0px;  clear: right;} #pagetitle {  float: left;  clear: left;  background-color: transparent;} #pagetitle h1{  font-family: "Verdana","Kalimati","Sans-serif";  font-weight: bold;  font-size: xx-large;  color: #ffffff;  padding: 4px;  margin: 0px;  } #companylogo {  float: right;  clear: right;  background-color: transparent;} #menu {  border: 0px;  background-color: #FFFFFF;  width: 100%;  min-width: 1024px;  height: 1em;  margin: 0px;  padding: 0px;  clear: both;}#menu ul {  margin-right: 0px;} #menu li {  list-style-type: none;  float: right;  width: 7em;  border: 0;} #menu a {  display: block;  border: 0;} #menu a img {  border: 0;} #menu a:active, a:link, a:hover, a:visited {  border: 0;}#mainbody {  border: 0px;   /* 1px Red solid; */  background-color: #FFFFFF;  margin: 0px;  width: 100%;  min-width: 1024px;  max-width: 1024px;  clear: both;} #toplinetext{  min-width: 1024px;  font-family: "Verdana","Kalimati","Sans-serif";  font-weight: bold;  font-size: medium;  color: #000000;} #viewinfo {  border: 1px;  border-color: #000000;  border-style: solid;  background-color: #009EE0;  width: 9em;  margin: 5px;  float: left;  clear: left;}#viewinfo p{  font-family: "Verdana","Kalimati","Sans-serif";  font-weight: bold;  font-size: large;  text-align: center;  color: #FFFFFF;  width: 8em;  margin: 1px;} #viewbuttons p {  clear: right;} #viewbuttons li {  list-style-type: none;  float: left;  width: 160px;  margin: 0;  margin-top: .2em;  margin-left: .8em;  border: 0;}#viewbuttons a img {  border: 0;} #viewbuttons a:active, a:link, a:hover, a:visited {  border: 0;} #reports {  border: 1px;  border-color: #000000;  border-style: solid;  background-color: #009EE0;  width: 9em;  margin: 5px;  float: left;  clear: left;}#reports p{  font-family: "Verdana","Kalimati","Sans-serif";  font-weight: bold;  font-size: large;  text-align: center;  color: #FFFFFF;  width: 8em;  margin: 1px;} #reportbuttons li {  list-style-type: none;  float: left;  width: 160px;  margin: 0;  margin-top: 2em;  margin-left: .8em;  border: 0;} #reportbuttons a img {  border: 0;} #reportbuttons a:active, a:link, a:hover, a:visited {  border: 0;}#infoediting {  border: 1px;  border-color: #000000;  border-style: solid;  background-color: #009EE0;  width: 9em;  margin: 5px;  float: left;  clear: left;} #infoediting p{  font-family: "Verdana","Kalimati","Sans-serif";  font-weight: bold;  font-size: large;  text-align: center;  color: #FFFFFF;  width: 8em;  margin: 1px;} #editbuttons li {  list-style-type: none;  float: left;  width: 160px;  margin: 0;  margin-left: .8em;  margin-top: 2.4em;  border: 0;} #editbuttons a img {  border: 0;} #editbuttons a:active, a:link, a:hover, a:visited {  border: 0;} 

As always any help much appreciated

Link to comment
Share on other sites

OK so I have finally solved this. I discovered the issue to be the comments at the start of the file ??? aggghhh! after going through the file over and over again. The only thing that was different was the comments at the top. I removed them and it works. I guess you cannot have comments at the top of the file. This is a shame as I always used to have a comment box at the top of files saying what they did and date created etc. Guess I will have to change my style with Web dev! Aggg again!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...