Jump to content

question on headers already sent


AdRock

Recommended Posts

This isn't my code but i still don't know why it saying this

 

init.php

<?php

session_start();

$host="localhost";
$user="root";
$password="201271";
$database="mycarshare";

mysql_connect($host,$user,$password);
@mysql_select_db($database) or die( "Unable to select database");

?>

 

login.php

<?php include_once("init.php"); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>My Car Share - Home Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="default.css" type="text/css" />
<style type="text/css">
<!--
.style1 {color: #FFFFFF}
a:hover {
color: #99CCFF;
text-decoration: none;
}
.style2 {
font-family: Verdana, Arial, Helvetica, sans-serif;
color: #FFCC33;
}
.style4 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; }
a:link {
text-decoration: none;
}
a:visited {
text-decoration: none;
}
a:active {
text-decoration: none;
}
-->
</style>
</head>
<body bgcolor="#ff9933">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr bgcolor="#FF9900">
<td width="15" nowrap="nowrap" bgcolor="#ff9933" ></td>
<td height="60" colspan="3" nowrap="nowrap" bgcolor="#ff9933" class="logo"><img src="header.png" width="680" height="80" /><br /></td>
<td width="40" bgcolor="#ff9933"/>
<td width="100%" bgcolor="#ff9933"/>
  </tr>

<tr bgcolor="#003399">
<td width="15" nowrap="nowrap" bgcolor="#ff9933"/>
<td height="36" colspan="3" nowrap="nowrap" bgcolor="#ff9933" class="navText" id="navigation"><a href="index.html">INDEX</a>     
      <a href="login.html">LOGIN</a>      <a href="register.html">REGISTER</a>  
          <a href="search.html">SEARCH</a>     
      <a href="contactus.html">CONTACT US</a>     </td>
  <td width="40" bgcolor="#ff9933"/>
<td width="100%" bgcolor="#ff9933"/>
</tr>

<tr bgcolor="#ffffff">
<td colspan="6"></td>
</tr>

<tr bgcolor="#ffffff">
<td width="230" colspan="2" valign="top" bgcolor="#ffffff"><table border="0" cellspacing="0" cellpadding="0" width="230">
	<tr>
	<td width="15"> </td>
	<td width="200" class="smallText" id="padding"><form id="login" name="login" method="post" action="checklogin.php">
	  <p class="style2">Login</p>
	  <p>
	    <label><span class="style4">Email</span><br />
	      <input type="text" id="myemail" name="myemail" />
	      </label>
	    </p>
	  <p>
	    <label><span class="style4">Password</span>
	    <input type="password" id="mypassword" name="mypassword" />
	    </label>
		</p>
	  <p>
	    <label>
	    <input type="submit" name="submit" id="submit" value="Login" />
	    </label>
	  </p>
	</form>
	<br />		</td>
	<td width="15"> </td>
	</tr>
</table>	</td>
<td width="50" valign="top"></td>
<td width="440" valign="top"><br />
 <br />
<table border="0" cellspacing="0" cellpadding="0" width="440">
	<tr>
	<td class="pageHeader">Login</td>
	</tr>

	<tr>
	<td class="bodyText"><p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. </p>

	<p> </p>

	 <br />		</td>
	</tr>
</table>	</td>
<td width="40"> </td>
<td width="100%"> </td>
</tr>

<tr bgcolor="#ffffff">
<td colspan="6"></td>
</tr>

<tr>
<td colspan="6"/>
</tr>

<tr>
<td width="15"/>
<td width="215"/>
<td width="50"/>
<td width="440"/>
<td width="40"/>
<td width="100%"/>
</tr>
</table>
	<address>© 
        <a href="mailto:[email protected]" class="style1">My Car Share</a>
      	</address>

</body>
</html>

 

There is no whitespace cos we have checked

It is likely that output buffering is now on in his php.ini, where as it was not on before.

 

If you post the actual error message, you will get a lot quicker solution.

 

My guess is the output the error mentions was started on line 1 of the file. If there is no specific white-space, this usually means the file was saved in UTF-8 format and the BOM (Byte Order Mark) characters at the start of the file are being output and this prevents the headers from being sent.

 

If you put these files onto a server where output buffering is not turned on in php.ini, the problem will expose itself again. You need to find and fix the actual problem with the file or with the code.

Archived

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

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.