In general, such a problem that is necessary when the system is entered so that the header (navigation.php) changes to (login-navigation)

They are in the same folder

I am redirecting the header in the file login-navigation.php

<?php session_start(); include_once 'db.php'; if (!isset($_SESSION['userSession'])) { header("Location: login-user.php"); } ?> 

Initially, my page is divided into header, content, footer.

Header on the index page, I call this way:

  <header class="header"> <div> <?php include('navigation.php'); ?> </header> 

The problem is that the same header remains

  • And for what sake of it to change, if you statically recorded it, without any dynamics? Where is the logic? - And

1 answer 1

You just confused (it happens with newbies): the function header () in PHP is an http request, and your header is a file / tag / block, etc. Instead of the function header () in your code, include the file using include () or require () with the desired file.

  • Thank :). It's not easy being a newbie - Jana