I am trying to pass PHP variable into a series of pages loading in a div within the admin page . Once I click a link a link the page refreshes and i am directed to login page. I tried to start a session in admin.php and put the variable in $_SESSION, but this didn't make sense.I am still directed to the login.php.
<?php
$_SESSION['user_id']=$_GET['msg'];
if(!isset($_SESSION['user_id'])){
# redirect to the login page
header('Location: login.php?msg=' . urlencode('Login first.'));
exit();
}
?>
<li><a href='admin.php?url=addnews.php'><span> News</span></a></li>
<li><a href='admin.php?url=addarticles.php'><span>Articles</span></a></li>
</div>