PHP Header Error on HTML Page

I’m trying to put some php I made into an html file but I’m running into a snag. My PHP script is a login in script and when I successfully login I get the folowing error:


Warning : Cannot modify header information - headers already sent by (output started at /home/tyharox1/public_html/login.php:64) in /home/tyharox1/public_html/login.php on line 83

Below is the code for the html file with with the php already writen in. Can anyone help me resolve this issue?

> <?php
>
>   
>
> session_start();
>
>   
>
> include ('mysql.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>
>
>
>
> <!--[if lt IE 9]>
>
>
>
> <script src="html5shiv.js"></script>
>
>
>
> <![endif]-->
>
>
>
> <link href='http://fonts.googleapis.com/css?family=Coda' rel='stylesheet' type='text/css'>
>
>
>
> <link rel="stylesheet" type="text/css" href="mainmenu.css"/>
>
>
>
> <link rel="stylesheet" type="text/css" href="submenu.css"/>
>
>
>
> <link rel="stylesheet" type="text/css" href="mainpage.css"/>
>
>
>
> <link rel="stylesheet" type="text/css" href="slideshow.css"/>
>
>
>
> <link rel="stylesheet" type="text/css" href="ribons.css"/>
>
>
>
> <script type="text/javascript" src="js/jquery-1.2.6.js"></script>
>
>
>
> <script type="text/javascript" src="js/startstop-slider.js"></script>
>
>
>
> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
>
>
>
> <!-- TemplateBeginEditable name="doctitle" -->
>
>
>
> <title>Home</title>
>
>
>
> <!-- TemplateEndEditable -->
>
>
>
> <!-- TemplateBeginEditable name="head" -->
>
>
>
> <!-- TemplateEndEditable -->
>
>
>
> <style type="text/css">
>
>
>
> body {
>
>
>
>           background-color: #222;
>
>
>
> }
>
>
>
> </style>
>
>
>
> </head>
>
>
>
> <body>
>
>
>
> <div>
>
>
>
> <img name="Logo" src="images/84087.jpg" width="100%" height="50px" alt="" />
>
>
>
> </div>
>
>
>
> <div id='mainmenu'>
>
>
>
>           <ul>
>
>
>
>                       <li class='active '><a href='Templates/index.html'><span>AITP</span></a></li>
>
>
>
>                        <li><a href='#'><span>test</span></a></li>
>
>
>
>                        <li><a href='#'><span>test</span></a></li>
>
>
>
>                        <li><a href='#'><span>test</span></a></li>
>
>
>
>                        <li><a href='#'><span>test</span></a></li>
>
>
>
>           </ul>
>
>
>
>     </div>
>
>
>
> </div>
>
>
>
> <div id="submenu">
>
>
>
>                     <ul>
>
>
>
>                                  <li class='active'><a href='Templates/index.html'><span>Home</span></a></li>
>
>
>
>                                  <li><a href='#'><span>About Us</span></a></li>
>
>
>
>                                  <li><a href='#'><span>Calendar</span></a></li>
>
>
>
>                                  <li><a href='#'><span>Contact</span></a></li>
>
>
>
>                                  <li><a href='#'><span>Members</span></a></li>
>
>
>
>                     </ul>
>
>
>
>           </div>
>
>
>
> <div>
>
>
>
> </div>
>
>   
>
> <div class="ribbon">
>
>
>
>     <h3>Memeber Login</h3>
>
>
>
>     <section id="filler">
>
>
>
>           Please Login
>
>
>
>     <?php
>
>   
>
> session_start();
>
>   
>
> include ('mysql.php');
>
>   
>
> if (isset ($_POST['submit'])) {
>
>
>
>                     $username = mysql_escape_string($_POST['username']);
>
>
>
>                     $password = mysql_escape_string(sha1($_POST['password']));
>
>  
>
>                     if (!empty ($username) && !empty ($password)) {
>
>
>
>                                         $sql = mysql_query ("SELECT * FROM users
>
>
>
>                                                                                           WHERE username='".$username."' AND
>
>
>
>                                                                                           user_password='".$password."' LIMIT 1");
>
>  
>
>                                         if (mysql_num_rows ($sql) > 0) {
>
>
>
>                                                   $_SESSION['loggedin'] = true;
>
>
>
>                                                   $_SESSION['username'] = $username;
>
>  
>
>                                                   header("Refresh: 2; url=index.html");
>
>   
>
>                                                                    echo '<span style="color: #063; font-weight: bold;">Login Successful! You are now being redirected, Please Wait...</span>';
>
>
>
>                                         }else{
>
>
>
>                                                   echo 'Your username and/or password is incorrect!';
>
>
>
>                                                   }
>
>  
>
>                     }else{
>
>
>
>                               echo 'You must enter a suername and password!';
>
>
>
>                     }
>
>
>
> }else{
>
>   
>
> echo '<form action="login.php" method="post">
>
>
>
> Username: <input type="text" name="username" /><br />
>
>
>
> Password: <input type="password" name="password" /><br />
>
>
>
> <input type="submit" name="submit" value="login" />
>
>   
>
> </form>';
>
>
>
> }
>
>   
>
> ?>
>
>
>
>     <section id="date">
>
>
>
>                     <span id="publisher">Publisher:</span> Jane Doe <span id="publisher">Date:</span> Oct. 10, 2012
>
>
>
>     </section>
>
>
>
>     </section>
>
>
>
> </div>
>
>   
>
> </div>
>
>
>
> <div id="footer">
>
>   
>
> </div>
>
>
>
> </body>
>
>
>
> </html>

session_start() should be the first thing to happen:

<?php
session_start();
?>

I don’t know how complete your posted code is - but even a space before the opening php-Tag can make trouble:

   <?php
session_start();
?>