So basically my problem is this message:
Warning: Cannot modify header information - headers already sent by (output started at /.../index.php:83) in /.../Controller.class.php on line 61
I've looked up what I should do about this, and the answers all tell me that I can only set my headers once. The problem is that I am using a template (I'm using dreamweaver) that the entire site has to use. By copying this template and changing a couple lines, I've figured out that if I comment out:
<?php include("includes/site_header.html"); ?>
in my code (which sets up the top of my page to look the same as every other page on the site; so it must stay), then I stop getting the error. Also, if I just move the code that has the header() call in it to the top of my code then it works, which makes sense...but then it's located at the top left corner of the page rather than in the pagecontainer it should be in.
So, is there something in the site_header.html that I could change to fix this? Or maybe just something I can do instead of using header()?
Here is the necessary code:
index.php:
<body>
<div id="pagecontainer">
<?php include("includes/UWheader_feedback.html"); ?>
<div id="primarycontent">
<?
include ('Controller.class.php');
?>
</div>
</div>
Controller.class.php:
function form() {
....
if($fb->valid()) {
$_SESSION['feedback'] = $fb;
return header('Location: ?action=preview'); // This is where the error comes from.
}