I know headers have got to be before any output to the browser but I have finally come up against a problem where i need to use
header ( "Location:
This is a very cut down version of the layout for my site and you can see that I have a switch that gets the page from the url and includes that page for display
- PHP: Select all
<?php
session_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></meta>
</head>
<body>
<div id="wrapper">
<div id="content">
<div id="header">
<img src="images/title.jpg" alt="title" />
</div>
<div id="left">
<div class="news">
<div class="heading">
<h3 class="head">Navigation</h3>
</div>
<-- Navigation goes here -->
</div>
</div>
<div id="content2">
<?php
//Main page content changes here
switch ($_GET['page'])
{
case "user_details":
include('user_details.php');
break;
default:
include('home.php');
}
?>
</div>
</div>
</div>
<div id="footer">
</div>
</body>
</html>
The problem that I'm going to come up against in one of the pages that get included, there is a
header ("Location: and I'm pretty sure that I'm going to get that headers already sent message.
Is there any way I can get around this?