Hi The problem is that the header requires that no output be generated by your script before it is invoked.
It makes this clear in the error message when it indicates that on line 6 you produced output! Try this instead (although the code seems a little confused). <?php session_start(); include_once("lib/lib_main.php"); dbConnect($host, $user, $pass); $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"); } 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>"; ?> "Mike Mapsnac" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > 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/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php