You need to put exit();
after your header redirection, otherwise you have just loaded two pages of content into 1 page.
Also make sure you have session_start();
at the top of all your scripts.
More Related Contents:
- Session variables not working php
- “Keep Me Logged In” – the best approach
- How to fix the session_register() deprecated issue?
- PHP: Storing ‘objects’ inside the $_SESSION
- Preventing session hijacking
- How can I fix the Permission error when I call session_start()?
- What is the default lifetime of a session?
- PHP sessions timing out too quickly
- proper way to logout from a session in PHP
- Maximum size of a PHP session
- Looping Through All a Server’s Sessions in PHP
- Can’t pass mysqli connection in session in php
- Multiple PHP Sessions
- Cross domain PHP Sessions
- Accessing session from TWIG template
- PHP Warning Permission denied (13) on session_start() [duplicate]
- Is this a proper way to destroy all session data in php?
- PHP __PHP_Incomplete_Class Object with my $_SESSION data
- How do I continue a session from one page to another with PHP
- Session hijacking and PHP
- CakePHP remember me with Auth
- Access active sessions in PHP
- PHP Session not Saving
- Laravel 5 Session Lifetime
- session_start hangs
- PHP session IDs — how are they generated? [duplicate]
- PHP authentication with multiple domains and subdomains
- session_start() takes VERY LONG TIME
- destroy session when broswer tab closed
- How to send cookies with file_get_contents