ajax - passing a PHP variable to pages loading in a div -
i trying pass php variable series of pages loading in div within admin page . once click link link page refreshes , directed login page. tried start session in admin.php , put variable in $_session, didn't make sense.i still directed login.php.
<?php $_session['user_id']=$_get['msg']; if(!isset($_session['user_id'])){ # redirect 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>
you haven't called session_start before setting session variables, , result session data not being saved between page refreshes or redirects.
<?php session_start(); $_session['user_id'] = $_get['msg'];
Comments
Post a Comment