PHP Error "Cannot Send Session Cache Limiter - Headers Already Sent ..."
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/1183726/headers-already-sent-in-php">Headers already sent in php</a>  </p>
</blockquote>



<p>I am receiving the following error: </p>

<blockquote>
  <p>Warning: session_start() [function.session-start]: Cannot send session
  cache limiter - headers already sent (output started at
  /home/content/t/a/t/brians/html/about.php:9) in
  /home/content/t/a/t/brians/html/includes/sidebar.php on line 2</p>
</blockquote>

<p>Within in about.php I have the following code to retrieve the sidebar.php file: </p>

<pre><code>&lt;?php include('includes/sidebar.php'); ?&gt;
</code></pre>

<p>In sidebar.php I have the following code:</p>

<pre><code>&lt;?php
session_start();

$data=array("user1"=&gt;array("url"=&gt;"file1.php","password"=&gt;"pass1"),
"user2"=&gt;array("url"=&gt;"file2.php","password"=&gt;"pass2"));

if(isset($_POST['username']) &amp;&amp; isset($_POST['password'])) {
if($data[$_POST['username']]['password'] == $_POST['password']) {
$_SESSION['username'] = $_POST['username'] . " " . $_POST['password'];
header('Location: ' . $data[$_POST['username']]['url']);
} else {
login('The username or password is incorrect. &lt;br /&gt;');
}
} else {
login();
}
?&gt;

&lt;?php

function login($response='This is the default message, if there is none provided') {

?&gt;

&lt;img src="../images/clientlogin_header.png" alt="Client Login"&gt;&lt;/img&gt;
&lt;p&gt;
&lt;div id="login-area"&gt;
            &lt;form action="" method="post"&gt;
                &lt;label for="username"&gt;username&lt;/label&gt;
                &lt;input type="text" name="username" /&gt;

                &lt;label for="password"&gt;password&lt;/label&gt;
                &lt;input type="password" name="password" /&gt;&lt;br /&gt;

                &lt;input type="submit" name="Login" value="Login" class="submit-button" /&gt;
            &lt;/form&gt;
            &lt;div style="clear: both;"&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/p&gt;
&lt;?php } ?&gt;
</code></pre>

<p>I can't exactly solve this error. Can anyone give me suggestions? </p>
