the below blocks of code should be at the very top of the page before you start your html session
<?php
if (isset($_SESSION['empID']))
{
// the user is logged in
echo "You are logged in, {$_SESSION['empID']}!
";
}
else
{
//the user is not logged in
header("Location:../pages/login.php");
//echo 'Log in';
}
?>
you can not have html and then a redirect a header
Iv done what wilson382 said but now but now im getting the same error just on s different line because i moved the php code
Warning: Cannot modify header information - headers already sent by (output started at /Applications/XAMPP/xamppfiles/htdocs/Assign2/inc/header.php:6) in /Applications/XAMPP/xamppfiles/htdocs/Assign2/inc/header.php on line 16
?>
it looks like there is something wrong with the
[php] header(“Location: …/pages/login.php”);[/php]
is it possible that the problem isn’t on this page but on the login.php page?
this is the login.php page code
[php]<?php
include “…/inc/header.php”;
?>
Login
Username:
Password:
<?php
include "../inc/footer.php";
?>[/php]