cannot modify header information puzzler

Posted by outofmyleague_lucy on Stack Overflow See other posts from Stack Overflow or by outofmyleague_lucy
Published on 2011-02-01T14:58:18Z Indexed on 2011/02/01 15:25 UTC
Read the original article Hit count: 233

Filed under:
|
|
|

hi im out of my league
i have written what has now become identical code for two sites hosted on different servers. the first worked perfectly and i have therefore used it to compare the second to.
from a login for i am directing to a loginaction.php when i include the db_connect.php ie

<?php session_start();
include 'db_connect.php';
$user=$_POST['formUser']
$password=$_POST['formPassword']

etc ? i am returning cannot modify header information header info already sent, but when i include the content of the db_connect ie

<?php session_start();
$connect = mysql_connect("localhost", "user", "pass");
mysql_select_db(db_name, $connection);
$user=$_POST['formUser']
$password=$_POST['formPassword']

etc ? it works.

any ideas?

edit - requested error message

Warning: Cannot modify header information - headers already sent by (output started at /home/avenncou/public_html/include/db_connect.php:4) in /home/avenncou/public_html/include/loginaction.php on line 14


at line 14 the is a
header("Location: {$_SERVER["HTTP_REFERER"]}");

edit - requested db_connect.php

<?php
    $connection = mysql_connect("localhost", "user", "pass");// or die ("Unable to connect!");   
    mysql_select_db("db", $connection);// or die ("Unable to select database!");  
?>


that is all of it (dies commented out in case thats where the error was)!!!

© Stack Overflow or respective owner

Related posts about php

Related posts about http