Warning: Cannot modify header information - headers already sent by (output sta
| From: | Mike Mapsnac | Date: | Wed, 10 Mar 2004 01:42:20 +0000 |
| Subject: | Warning: Cannot modify header information - headers already sent by (output sta | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-179967@lists.php.net to get a copy of this message | ||
This code below gives me this error message:
Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/account.php:6) in /var/www/html/account.php on line 17
The script check in the database if user exists and than redirect the page to the home index.php page. I know the problem exist in the header() .. But I don't understand why?
<?php
session_start();
include_once("lib/lib_main.php");
dbConnect($host, $user, $pass);
echo "<FORM ACTION=\"$PHP_SELF\" METHOD=\"POST\">";?>
<table align="center">
<tr><td>Username:</td><td> <input type="username" name="username"></td></tr>
<tr><td>Password:</td><td> <input type="password" name="password"></td></tr>
<tr><td></td><td align="center"><input type="submit" name="submit" value="Submit"></td><tr>
<?php echo "</FORM>";
$password = $_POST['password'];
$username = $_POST['username'];
$sql_login = mysql_query("SELECT id from user WHERE username='$username' and password=password('$password')");
if(mysql_num_rows($sql_login)) {
header("Location: http://www.index.php");
} ?>
_________________________________________________________________
Find things fast with the new MSN Toolbar includes FREE pop-up blocking! http://clk.atdmt.com/AVE/go/onm00200414ave/direct/01/