title: PHP Error : Warning: Cannot modify header information - headers already sent by
body: <p>Plese Help me : when I lock LOGIN button, show the error, I can not fix this proplem. i am new in php.</p>
  
  <p>Warning: Cannot modify header information - headers already sent by (output started at /home/kanak/public_html/celltopc/login.php:33) in /home/kanak/public_html/celltopc/login.php on line 56</p>
  
  <p>My code is :</p>
  
  <pre><code>  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
  &lt;title&gt;Login&lt;/title&gt;
  &lt;link href="css/usercss.css" rel="stylesheet" type="text/css" /&gt;
  &lt;style type="text/css"&gt;
  &lt;!--
  body {
      background-image: url(images/LoginForm_bg.jpg);
      background-repeat: repeat;
  }
  --&gt;
  &lt;/style&gt;&lt;/head&gt;
  
  &lt;body&gt;
  &lt;div class="shadow" id="login"&gt;
    &lt;div id="login-body"&gt;
    &lt;form action="login.php" method="post" name="loginform"&gt;
      &lt;strong&gt;Username:&lt;/strong&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
      &lt;input name="username" type="text" class="input" value="username" maxlength="10" /&gt;
  
      &lt;p&gt;&lt;br /&gt;
    &lt;strong&gt;Password:&lt;/strong&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
    &lt;input name="password" type="password" class="input" value="password" /&gt;
  
    &lt;p&gt;&lt;br /&gt;
     &lt;input type="submit" name="submit" value="Login" width="30" class="myButton"&gt;
  
    &lt;/form&gt;
  
     &lt;p&gt; &lt;br /&gt;
  &lt;?php
  ob_start();
  @session_start();
  include'include/config.php';
  include'include/opendb.php';
  @$username=$_POST['username'];
  @$password=$_POST['password'];
  
      if($username&amp;&amp;$password)
      {
      $connect=mysql_connect("$dbhost","$dbuser","$dbpass")or die("Couldnt connect to Database");
      mysql_select_db("$dbname") or die ("Could not find to Database");
      $query = mysql_query ("SELECT * FROM user WHERE username='$username'");
      $numrows = mysql_num_rows($query); 
      if ($numrows != 0)
          {
          while ($rows = mysql_fetch_assoc($query))
              {
              $dbusername = $rows['username'];
              $dbpassword = $rows['password'];
              }
                  if($username==$dbusername&amp;&amp;$password==$dbpassword)
                  {
  header("location:main.php");
  
  $_SESSION['username']=$dbusername;
                  }
                  else        
                  die("&lt;p class=error&gt;*&amp;nbsp;Increate Password&lt;/p&gt;");     
  
          }
          else die("&lt;p class=error&gt;*&amp;nbsp;The username doesnot exist&lt;/p&gt;");
      }
      else die ("&lt;p class=text&gt;*&amp;nbsp;Please entre a username and password&lt;/p&gt;");
  ?&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>