Question : PHP Session 'sticking' problem in IE but not Chrome/FF/Opera

I have a membership application written in PHP.  The form works fine, and submission works fine.  The form submits to page2 where the user is asked to check their information.  All of the user entered information is displayed and if they need to change it, they just click 'Back', edit the information and resubmit.

Problem is that when they return to the form in IE8, all the information is gone, even though the session number is the same (I checked).  All of the information IS displayed in Chrome, FF and Opera.

I start each page with:
session_start();
if (!$_SESSION['security_number']){
      $_SESSION['security_number']=rand(100000,999999);
} else {
      session_regenerate_id();
}

I'm using a random six digit 'security' number because I have the user enter that number into a custom captcha check.

Answer : PHP Session 'sticking' problem in IE but not Chrome/FF/Opera

What version of PHP and IE?

I tested this using the two files below, and they worked perfectly in both IE and Opera (latest versions of both).

Could be a problem of an older version of something not handling it correctly, in which case you could try this:
session_start();
$old_sessid = session_id();
session_regenerate_id();
$new_sessid = session_id();
session_id($old_sessid);
$old_session = $_SESSION;
session_destroy();
session_id($new_sessid);
session_start();
$_SESSION = $old_session;


Here are the two files that I tried and worked in both IE and Opera:

<?php
      //TEST.PHP
      session_start();
      if(!isset($_SESSION['security_number']) || !is_numeric($_SESSION['security_number'])) {
            $_SESSION['security_number'] = rand(100000,999999);
      }
      else {
            session_regenerate_id();
      }
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
      <head>
            <title>Test</title>
            <meta http-equiv="content-type" content="text/html; charset=utf-8" />
            <meta http-equiv="content-style-type" content="text/css" />
      </head>
      <body>
            <?php echo $_SESSION['security_number'].'<br />'; ?>
            <a href="test1.php">Go Forward</a>
      </body>
</html>




<?php
      //TEST1.PHP
      session_start();
      if(!isset($_SESSION['security_number']) || !is_numeric($_SESSION['security_number'])) {
            $_SESSION['security_number'] = rand(100000,999999);
      }
      else {
            session_regenerate_id();
      }
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
      <head>
            <title>Test 1</title>
            <meta http-equiv="content-type" content="text/html; charset=utf-8" />
            <meta http-equiv="content-style-type" content="text/css" />
      </head>
      <body>
            <?php echo $_SESSION['security_number'].'<br />'; ?>
            <a href="test.php">Go Back</a>
      </body>
</html>
Random Solutions  
 
programming4us programming4us