Hello,

So i am trying to get a log in page to work but have run into this error:

Warning: Cannot modify header information - headers already sent by (output started at .../views/header.php:15) in .../classes/login.php on line 77

I searched online and found others had this problem although I can't figure out where the output is being outputted... I changed the header.php to the following:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Sample</title>
<link rel="stylesheet" href="/views/css/inner.css" />
<link rel="stylesheet" href="/views/css/multiple-select.css" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="/views/js/multiple.js"></script>
<script type="text/javascript" src="/views/js/jsvalidationcontrol.js"></script>
</head>

<body>
<div id="wrapper">
<div class="header"><div class="logo"><a href="#" title="Logo">QBank&nbsp;<sup style="font-size:13px;">Beta</sup></a></div>   </div>

Line 15 is the last line in this file. There used to be php output here but removed it all. The header() call is here:

            else 
            {
                header("location:home.php");
                // write user data into PHP SESSION [a file on your server]
                $_SESSION['user_id'] = $result_row->user_id;
                $_SESSION['username'] = $result_row->username;
                $_SESSION['email'] = $result_row->email;
                $_SESSION['user_logged_in'] = 1;
            }
        }

I have no idea where output is being made. Any thoughts? Thanks in advance.

Cheers,

come_again

Recommended Answers

All 2 Replies

make sure session_start() function is the first line of code.. If this is true, than place ob_start() after session_start();

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.