RE: [PHP] Warning: Cannot modify header information - headers already sent by (o

From: Date: Wed, 10 Mar 2004 12:30:47 +0000
Subject: RE: [PHP] Warning: Cannot modify header information - headers already sent by (o
Groups: php.general 
Request: Send a blank email to php-general+get-180010@lists.php.net to get a copy of this message
Thank for your help .. One more question: I include header to the acount.php page. And it gives the same error, but in this situation I don't have any outputs. Also, I start session in header, not in the account. <?php //Account.php //session_start(); include_once("lib/lib_main.php"); dbConnect($host, $user, $pass); include_once 'header_account.php'; $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)) { $_SESSION['login'] = 'register'; $_SESSION['name'] = "$username"; Header("Location: " ."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></table> <?php echo "</FORM>"; ?> //File: header_account.php <?php session_start(); ?> <LINK REL="stylesheet" HREF="style.css" TYPE="text/css"> <table width="100%" align="center" border=1 cellpadding=0 cellspacing=0> <tr><td bgcolor="#5bb9f7">&nbsp;</td></tr> <tr><td align="center" bgcolor="FFFFFF"> <b><A HREF="/" CLASS="pointerBar">Home</A>&nbsp;&nbsp;&nbsp;&nbsp;<A HREF="resize.php" CLASS="pointerBar">Resize</A></td><tr> <tr><td bgcolor="#5bb9f7">&nbsp;</td></tr> </table>
From: "Chris W. Parker" <cparker@swatgear.com> To: "Mike Mapsnac" <mikerh9@hotmail.com>,<php-general@lists.php.net> Subject: RE: [PHP] Warning: Cannot modify header information - headers already sent by (output sta Date: Tue, 9 Mar 2004 17:46:21 -0800 Mike Mapsnac <mailto:mikerh9@hotmail.com>
    on Tuesday, March 09, 2004 5:42 PM said:
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? the error is telling you that you cannot output anything to the client BEFORE modifying the headers, i.e. redirecting. you have a lot of output starting on line 6 in /var/www/html/account.php. hth, chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
_________________________________________________________________ FREE pop-up blocking with the new MSN Toolbar – get it now! http://clk.atdmt.com/AVE/go/onm00200415ave/direct/01/

« previous php.general (#180010) next »