2015-08-25 00:51 阅读 17


I have a site that changes whenever a new location is changed. The location choices is by using a drop down. And on change calls this function:

    function PROD_CHANGE_LOC() {
      location_change = document.getElementById("PROD_SEL_LOC").value;
      varURL = "http://" + varServerAddr +
        "/hourly_ft_wip/production_line/prod_line_loc.php?location_change=" +
        location_change, LOAD(varURL, "LOCATION");

      setTimeout(function() {
      }, 100);

prod_line_loc.php just contains:

$_SESSION['HOURLY_FT_WIP']['PROD_LOC'] = $_REQUEST['location_change'];

And it returns to my main page that sets location by using this:


This is working in our server, but we had to transfer to a new server and sometimes the session is changed. But sometimes it doesn't. Are there any settings to look that might affect this?

The only difference I see in them is in our old server it is located in var/www/folder but in our new server it is located in var/www/html/folder

Also the reason I have a sleep function it doesn't work in Firefox without that.

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

2条回答 默认 最新

  • 已采纳
    dongzg2006 dongzg2006 2015-08-25 02:52

    I found the solution. I don't understand why or how it happened. But the solution is instead of:

    $_SESSION['HOURLY_FT_WIP']['PROD_LOC'] = $_REQUEST['location_change'];

    it should be:

    $_SESSION['HOURLY_FT_WIP']['PROD_LOC'] = $_GET['location_change'];

    This magically solved my problem. Anyway thank you for all those who answered and comment.

    点赞 评论 复制链接分享
  • duanjue6584 duanjue6584 2015-08-25 01:23

    As stated:


    needs to be on every php page; in cases where you are embedding ajax calls it also needs to be on the ajax/php pages.

    You can use:


    if you want to make sure your using the same session

    you can also use database storage for your sessions which may fit more within your means.

    As an edit:

        if(!isset($_SESSION)) {

    This is what should be on every page. If the session has been started it wont come back with an error if not it will start. This way you wont lose the session between pages.

    点赞 评论 复制链接分享