php redirect problem (header) - whats wrong with my code [closed]

sherryd142

New Member
Possible Duplicate:
Cannot modify header information - headers already sent, Why its happening Hi All ,this is related to my previous question and just because I cant add this code, I'm putting this as a new questionMy Question is when I'm trying to redirect the below php page it gives me this errorWarning: Cannot modify header information - headers already sent by (output started at login.php:5) in /login.php on line 17<!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>Administration Dashboard</title> <?php require_once 'db/db_functions.inc'; require_once 'functions/user_functions.inc'; require_once 'functions/string_functions.inc'; require_once 'functions/messages.inc'; require_once 'functions/login.inc'; $message_count = -1; $messages = array(); if (!isset ($_POST['Submit']) || $_POST['Submit'] != 'Login'){ $login = $_POST['login']; $password = $_POST['password']; if ((do_login($login, encrypt_password($password))) > 0){ header("dashboard"); } else{ $message_count = 1; } } ?> <link rel="stylesheet" type="text/css" href="http://stackoverflow.com/questions/3875220/stylesheets/admin/theme.css" /> <link rel="stylesheet" type="text/css" href="http://stackoverflow.com/questions/3875220/stylesheets/admin/style.css" /> <link rel="stylesheet" type="text/css" href="http://stackoverflow.com/questions/3875220/stylesheets/admin/theme1.css" /> <!--[if IE]> <link rel="stylesheet" type="text/css" href="http://stackoverflow.com/questions/3875220/stylesheets/admin/ie-sucks.css" /> <![endif]--> </head> <body> <div id="container"> <div id="header"> <h2>Sierra - Login</h2> </div> <div id="wrapper"> <div id="content"> <div id="box"> <? if ($message_count != -1){ if ($message_count > 0){ create_login_error_message($messages); } } ?> <form id="form" action="login.php" method="post"> <fieldset id="personal"> <legend>LOGIN INFORMATION</legend> <label for="lastname">Login : </label> <input name="login" id="login" type="text" tabindex="1" /> <br /> <label for="pass">Password : </label> <input name="password" id="password" type="password" tabindex="2" /> <br /> </fieldset> <div align="center"> <input id="button1" type="submit" value="http://stackoverflow.com/questions/3875220/Login" /> or <a href="">Cancel</a> </div> </form> </div> </div> </div> <div id="footer"> <!-- footer --> <? require_once('includes/footer.inc'); ?> </div> </div> </body></html>
 
Back
Top