RE: [PHP] Warning: Cannot modify header information - headers alr eady sent by (output sta

From: Date: Wed, 10 Mar 2004 01:45:32 +0000
Subject: RE: [PHP] Warning: Cannot modify header information - headers alr eady sent by (output sta
Groups: php.general 
Request: Send a blank email to php-general+get-179969@lists.php.net to get a copy of this message
It's exactly as the error says... You've echo'ed something out before the header statement. Move your database query and header() above all the echos and it should then work. Martin > -----Original Message----- > From: Mike Mapsnac [mailto:mikerh9@hotmail.com] > Sent: Wednesday, 10 March 2004 12:42 PM > To: php-general@lists.php.net > Subject: [PHP] Warning: Cannot modify header information - headers > already sent by (output sta > > > 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 > __________ Information from NOD32 1.617 (20040206) __________ > > This message was checked by NOD32 for Exchange e-mail monitor. > http://www.nod32.com > > > >

« previous php.general (#179969) next »