jquery - PHP Session ID the same but variables are lost -


i have login page sets session variables upon successful login. login page redirects admin page. admin page able read session variables fine. when jquery load() function loads viewusers.php in content div session variables gone. weird part session id same.

i used var_dump() on both admin page , viewusers page. admin pages shows proper variables login page viewusers page called jquery load() function var_dump of $_session blank. var_dump of $_cookie['phpsessid'] has proper id though, doesn't make sense me.

this how set session variables.

$_session['userid'] = $userinfo['id']; $_session['usertype'] = $userinfo['usertype']; $_session['programid'] = $userinfo['programid']; 

this jquery

$("#content").load("viewusers.php"); 

all pages have session_start() @ top. session variables didn't work when tried window.open , window.location instead of jquery load() function.

some how session variables getting lost though have correct session id. if shed light on appreciate it!

as of right i'm populating hidden fields , using post function instead of load around it. understand isn't best way, it's way figure out how it.

edit: here top of index read session variables fine.

 <?php     session_start();     //require("session.php");     if(!isset($_session['userid'])){         header("location: ../login/index.php");     } ?> 

here entire viewusers

    <?php  session_start();  //foreach($_post $name => $value){     //$_session[$name] = $value; //}  //echo " session id " . $_cookie['phpsessid']; var_dump($_cookie); var_dump($_session); ?>  <?php require("adminfunctions.php"); ?>   <h2>view current users</h2> <?php require("userlinks.php"); ?> <table id="usertable" class="tablesorter">     <?php getusers($_session['programid'], $_session['usertype']) ?> </table> <script type="text/javascript">      $('td[name="userid"]').hide();      //$("#usertable th").click(function(){         //color();         //colortable();         //color();     //});      function colortable(){         $("tr:odd").css("background-color", "#c0c0c0");         $("tr:even").css("background-color", "#ffffff");     }      function color(){         $("tr:odd").css("background-color", "#ffffff");         $("tr:even").css("background-color", "#ffffff");     }      $(document).ready(function(){         //colortable();         $("#usertable").tablesorter({widgets: ['zebra']});      }); </script> 

another edit: here javascript code load viewusers reason i'm using post because set session variables hidden fields in order pass session variables. on viewusers use foreach loop set session variables. understand isn't secure. function maintainusers(){

$.post("viewusers.php", $("#sessionform").serialize(),function(data){         //alert(data);         $("#content").load("viewusers.php");     }); } 

might long shot using framework or cms? know wordpress delete session variables (http://blog.ginchen.de/en/2008/08/15/session-variablen-in-wordpress/) can show javascript code you're using load viewusers? programming on local server?


Comments