2

I login successfully and goto desire page. But i have another page for admin. In this page i see some error with the same code that is working another page. Error 'Warning: Cannot modify header information - headers already sent'

<?php

session_start();

 if(!isset($_SESSION["user_name"]))
    {
        header("location:Index.php");
    }
    
    
?>
  • this happens when a redirect instruction is set but an output already started and redirect instruction cannot be completed. a classical example is when you print something before a header("Location...") instruction. An output can also be the output of an error reporting function – Ace_Gentile May 23 '17 at 15:33

0 Answers0