title: PHP session is working on localhost but not on actual server
body: <p>i'm having trouble to pass session variable to another page. It is working on localhost but not on server. I would want to pass $_SESSION['user_check'] to editpasswordsignup.php but whenever i click submit, $_SESSION['user_check'] is empty. </p>
  
  <p>This is loginsignup.php</p>
  
  <pre><code>&lt;?php
  
  include('db.php');
  
  session_start(); 
  
  ?&gt;
  
  &lt;div id="wrapper"&gt;
  &lt;div id="wrapper-bg"&gt;
  &lt;div id="wrapper-bgtop"&gt;
    &lt;div class="container" id="header"&gt;
      &lt;div class="container" id="logo"&gt;
        &lt;h1&gt;&lt;a href="indexhomepage.php"&gt;&lt;/a&gt;&lt;/h1&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  
    &lt;div class="container" id="page"&gt;
      &lt;div id="loginbox"&gt;
          &lt;form action="" class="formbox" method="post"&gt;
          &lt;label&gt;Email Address:&lt;/label&gt; 
          &lt;input class="box1" name="email" type="text"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
          &lt;label&gt;Password:&lt;/label&gt; 
          &lt;input class="box2" name="password" type="password"&gt; 
          &lt;a class="myButton1" href="forgetpassword.php"&gt;Forgot Password&lt;/a&gt;&lt;br&gt;
          &lt;input class="submit5" name="submit" type="submit" value="Login"&gt; 
          &lt;a href="signup.php" id="myButton2"&gt;Create Account&lt;/a&gt;
          &lt;/form&gt;
  
              &lt;?php
  
              if (isset($_POST['submit']))
              {
              $email =   ($_POST["email"]);
              $password =($_POST["password"]);
  
              $_SESSION['user_check'] = $_POST["email"];
  
              $sql = mysql_query ("SELECT * FROM user WHERE email = '$email'  ");
  
              $row = mysql_fetch_array($sql);
  
              $drawemail = $row['email'];
  
              $drawpassword = $row['password'];   
  
              if (($drawemail == $email ) &amp;&amp; ($drawpassword == $password ))
  
              {
              ?&gt;
              &lt;script&gt;window.location = "../wordsignup.php";&lt;/script&gt;;
  
              &lt;?php
              }
  
              else 
              {
              echo "wrong password or username";
              }
              }
  
              ?&gt;
  
      &lt;/div&gt;
    &lt;/div&gt;
  
    &lt;div class="container" id="footer-content-bg"&gt;
      &lt;div id="footer-content"&gt;
        &lt;ul&gt;
          &lt;li class="footer1"&gt;
            &lt;a href="aboutus.php"&gt;About us&lt;/a&gt;
          &lt;/li&gt;
  
          &lt;li&gt;
            &lt;a href="termandcon.php"&gt;Term and Conditions&lt;/a&gt;
          &lt;/li&gt;
  
          &lt;li&gt;
            &lt;a href="privacyadvertising.php"&gt;Privacy Advertising&lt;/a&gt;
          &lt;/li&gt;
  
          &lt;li&gt;
            &lt;a href="policy.php"&gt;Policy&lt;/a&gt;
          &lt;/li&gt;
  
          &lt;li&gt;
            &lt;a href="userargeement.php"&gt;User Agreement&lt;/a&gt;
          &lt;/li&gt;
        &lt;/ul&gt;&lt;br&gt;
  
        &lt;div id="copyright"&gt;
          © . All Rights Reserved.
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>
  </p>
  
  <p>This is editpasswordsignup.php</p>
  
  <pre><code>  &lt;?php 
  
    include('db.php');
  
    session_start();
  
    $user_check = $_SESSION['user_check'];
  
    ?&gt;
  
   &lt;div id="wrapper"&gt;
  &lt;div id="wrapper-bg"&gt;
  &lt;div id="wrapper-bgtop"&gt;
    &lt;div class="container" id="header"&gt;
      &lt;div class="container" id="logo"&gt;
        &lt;h1&gt;&lt;a href="indexhomepage.php"&gt;&lt;/a&gt;&lt;/h1&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  
    &lt;div class="container" id="page"&gt;
      &lt;div id="forgetpassword"&gt;
        &lt;div style="font-size:20px; color:#000080; font-weight:bold; border-width:1px; border-style:none; width:600px; margin:10px 0px 0px 175px;"&gt;
          Edit Password
        &lt;/div&gt;
  
        &lt;div style="font-size:16px;border-style:none; width:560px; margin:20px 0px 10px 175px; font-weight:bold;"&gt;
          Please enter your old password below and we will send you your password.
        &lt;/div&gt;
  
        &lt;div id="forgetpasswordbox"&gt;
          &lt;form class="forgetpassword" method="post"&gt;
          Please enter your old password&lt;br&gt;
          &lt;input class="oldpassword" name="oldpassword" type="password"&gt;&lt;br&gt;&lt;br&gt;
          Please enter your new password&lt;br&gt;
          &lt;input class="newpassword" name="newpassword" type="password"&gt;&lt;br&gt;&lt;br&gt;
          Please re-enter new password&lt;br&gt;
          &lt;input class="confirmpassword" name="confirmpassword" type="password"&gt;&lt;br&gt;&lt;br&gt;     
          &lt;input name="submit" type="submit" value="Send" class="send"&gt;
          &lt;/form&gt;
  
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  
    &lt;div class="container" id="footer-content-bg"&gt;
      &lt;div id="footer-content"&gt;
        &lt;ul&gt;
          &lt;li class="footer1"&gt;
            &lt;a href="aboutus.php"&gt;About Us&lt;/a&gt;
          &lt;/li&gt;
  
          &lt;li&gt;
            &lt;a href="termandcon.php"&gt;Term and Conditions&lt;/a&gt;
          &lt;/li&gt;
  
          &lt;li&gt;
            &lt;a href="privacyadvertising.php"&gt;Privacy Advertising&lt;/a&gt;
          &lt;/li&gt;
  
          &lt;li&gt;
            &lt;a href="policy.php"&gt;Policy&lt;/a&gt;
          &lt;/li&gt;
  
          &lt;li&gt;
            &lt;a href="userargeement.php"&gt;User Agreement&lt;/a&gt;
          &lt;/li&gt;
        &lt;/ul&gt;&lt;br&gt;
  
        &lt;div id="copyright"&gt;
          © . All Rights Reserved.
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
     &lt;/div&gt;
    &lt;/div&gt;
    &lt;/div&gt;
  
      &lt;?php       
      if (isset($_POST['submit']))
      {               
      $oldpassword = $_POST['oldpassword'];
      $newpassword = $_POST['newpassword']; 
      $confirmpassword = $_POST['confirmpassword']; 
  
      $sql = mysql_query (("SELECT * FROM user WHERE email='user_check' AND password='$oldpassword' "),$conn);
  
      $row = mysql_fetch_array($sql);
      $email = $row['email'];
      $selectpassword = $row['password'];
  
      if ($oldpassword == "")
      {
  
      echo '&lt;script language="javascript"&gt;';
      echo 'alert("pls enter your oldpassword")';
      echo '&lt;/script&gt;';
      exit;
      }
  
      if($newpassword=="")
      {
      echo '&lt;script language="javascript"&gt;';
      echo 'alert("pls enter your newpassword")';
      echo '&lt;/script&gt;';
      exit;
  
      }
  
      if($confirmpassword=="")
      {
      echo '&lt;script language="javascript"&gt;';
      echo 'alert("pls enter your confrimpassword")';
      echo '&lt;/script&gt;';
      exit;
  
      }       
  
      if (($oldpassword) != ($selectpassword)) 
      {
      echo '&lt;script language="javascript"&gt;';
      echo 'alert("No user exists with this password  '.$selectpassword.' ")';
      echo '&lt;/script&gt;';
      exit;
      }
  
      if ($newpassword == ($confirmpassword))
      {   
      mysql_query("UPDATE user SET password = '".$newpassword."' WHERE email='".$email."'");
  
      $message = "Your password ".$newpassword." and click the link uploadsignup.php to upload your photo";   
  
      mail($email, "Change Password", $message);
      ?&gt;
  
      &lt;script&gt;
  
      alert("Password Successfully change...!!!!\nClick OK to upload photo\nNewpassword will send to your email address");
      window.location="uploadsignup.php";
  
     &lt;/script&gt;   
  
  
      &lt;?php
      }
      else 
      {
      echo '&lt;script language="javascript"&gt;';
      echo 'alert("new password does not match")';
      echo '&lt;/script&gt;';
  
      }
      }
  
      ?&gt;
  </code></pre>