Not really LFS related but I'm sure someone here can point me in the right direction! Have done a few google searches but can't find anything similar to my particular problem.
Error Message
What is throwing me with the error message is the fact that the offending code is line 45 but the header statement is line 3. Line 45 is where the next <?php opening tag is, the section with the 'switch' statements. I'd understand the problem if I had something before I called the header statement . The function test is being called from within the included 'add.php.'
Also forgot to mention that the function is called on a 'post' submit.
Error Message
<?php
Warning: Cannot modify header information - headers already sent by (output started at /Applications/XAMPP/xamppfiles/htdocs/DOPNEW/admin/index.php:45) in /Applications/XAMPP/xamppfiles/htdocs/DOPNEW/admin/index.php on line 3
?>
Also forgot to mention that the function is called on a 'post' submit.
<?php
php
function test(){
header("Location: index.php");
}
<!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>Untitled Document</title>
</head>
<body>
<div id="header">
<div id="headerLogo"><img src="../web/dop-logo-admin.png" alt="dop logo" /></div>
<div id="headerSearch">
<form action="#" method="post">
<div>
<input type="text" name="headSearch" value="test" />
<select name="searchPlace">
<option>Test</option>
<option>Test 2</option>
</select>
</div>
</form>
</div>
<div id="headerInfo"></div>
</div>
<div id="container">
<div id="leftNav">
<ul>
<li><a href="#" title="products admin">Products</a></li>
<li><a href="#" title="products admin">Stock</a></li>
<li><a href="#" title="suppliers admin">Suppliers</a></li>
<li><a href="#" title="categories admin">Categories</a></li>
<li><a href="#" title="customers admin">Customers</a></li>
<li><a href="#" title="settings">Settings</a></li>
</ul>
</div>
<div id="rightContent">
php
$section = $_GET['section'];
switch($section){
case 'product':
$action = $_GET['action'];
switch($action){
case 'add':
include_once('product/add.php');
break;
}
break;
}
</div>
<div id="footer">Test</div>
</div>
</body>
</html>
?>