cześć wszystkim
robię stronę i mam zgrzyt z trzema błędami. Kompletnie nie wiem o co chodzi. Wiem, że błąd dotyczy headów i przesyłania w nich informacji, ale nie rozumiem co robię źle. Proszę o pomoc. Błąd który występuje:
Warning: Cannot modify header information - headers already sent by (output started at /wp-content/themes/instrukcje/standar_show/layout_header.php:9) in /wp-content/themes/instrukcje/standar_show/read_template.php on line 55
index -> strona w której wybieram element z comboboxa i klikam na przycisk żeby aktywować comboboxa. Tu pojawia się komunikat, który podałem wyżej
<?php
session_start();
if(!($_SESSION['log'])){
header("Location: /wp-content/themes/instrukcje/standar_show/index.php?error=4");
exit;
}
?>
<?php
include_once 'config/core.php';
include_once 'config/database.php';
include_once 'objects/instruction.php';
include_once 'objects/category.php';
$database = new Database();
$db = $database->getConnection();
$instruction = new Instruction($db);
$category = new Category($db);
$page_title = "Read Instruction";
include_once "layout_header.php";
$stmt = $instruction->readAll($from_record_num, $records_per_page);
$page_url = "index.php?";
$total_rows=$instruction->countAll();
include_once "read_template.php";
include_once "layout_footer.php";
?>
layout_header
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
**<title><?php echo $page_title;?></title>**PIERWSZY BŁĄD
<!-- Latest compiled and minified Bootstrap CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" />
<!-- our custom CSS -->
<link rel="stylesheet" href="libs/css/custom.css" />
</head>
<body>
<!-- container -->
<div class="container">
<?php
// show page header
echo "<div class='page-header'>
<h1>{$page_title}</h1>
</div>";
?>
read_template
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootbox.js/4.4.0/bootbox.min.js"></script>
<?php
echo "<div class='right-button-margin'>";
echo "<a href='../standar.php' class='btn btn-primary pull-right'>";
echo "<span class='glyphicon glyphicon'></span> Back Menu ";
echo "</a>";
echo "</div>";
if($total_rows>0){
echo "<div class='page-header'>
<h4>Last 5 instructions</h4>
</div>";
echo "<div>";
echo "<table class='table table-hover table-responsive table-bordered'>";
echo "<tr>";
echo "<th>Name</th>";
echo "<th>Date</th>";
echo "<th>Actions</th>";
echo "</tr>";
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)){
extract($row);
echo "<tr>";
echo "<td>{$name}</td>";
echo "<td>{$modified}</td>";
echo "<td>";
echo "<a href='read_one.php?id={$id}' class='btn btn-primary left-margin'>";
echo "<span class='glyphicon glyphicon-list'></span> Read";
echo "</a>";
echo "</td>";
echo "</tr>";
}
echo "</table>";
echo "</div>";
}
// tell the user there are no users
else{
echo "<div class='alert alert-danger'>No instructions found.</div>";
}
?>
<?php
if($_POST){
if(isset($_POST['cat_id_select'])){
$_SESSION['cat_id_select'] = $_POST['cat_id_select'];
$_POST['cat_id_select'] = null;
**header('Location: /wp-content/themes/instrukcje/standar_show/showAll_category.php');**DRUGI BŁĄD
}
if(isset($_POST['subcat_id_select'])){
$_SESSION['subcat_id_select'] = $_POST['subcat_id_select'];
$_POST['subcat_id_select'] = null;
**header('Location: /wp-content/themes/instrukcje/standar_show/showAll_subcategory.php')**;TRZECI BŁĄD
}
}
echo "<div class='page-header'>
<h4>Category/subcategory filter</h4>
</div>";
?>
<div>
<table class='table table-hover table-responsive table-bordered'>
<form method="post">
<tr>
<td>
<select id="category-select" name="cat_id_select" class="clear-right">
<option value="0" >Select a category</option>
<option value="1">Szkolenia</option>
</select>
</td>
<td>
<button type="submit" class="btn btn-primary">Show All Category</button>
</td>
</tr>
</form>
<form method="post">
<tr>
<td>
<select id="subcategory-select" name="subcat_id_select" class="clear-right">
<option value="0">Select a subcategory</option>
<optgroup label="Programy">
<option value="1">profilaktyczny</option>
</select>
</td>
<td>
<button type="submit" class="btn btn-primary">Show All Subcategory</button>
</td>
</tr>
</form>
</table>
</div>