title: Using PHP sessions causes page to expire from cache when returning from another site
body: <p>I have a form in which the first button posts back to the form; the second button posts to a form at another website; the third button posts to another form at my website.</p>
  
  <p>I am trying to pass a variable from form1.php to form2.php using sessions. The problem is that if I click the second button and then click `Back' to get back to my site, the browser says that the page is not in the cache and I have to reload it. Of course, If I comment out both calls to session_start, I get back to my page as I left it.</p>
  
  <p>What am I doing wrong? See code below.</p>
  
  <p>form1.php</p>
  
  <pre><code>&lt;?php
    session_start();
  ?&gt;
  
  &lt;html&gt;
    &lt;head&gt;&lt;/head&gt;
  
  &lt;body&gt;  
  
  &lt;form id="form1" action="form1.php" method="post"&gt;
  &lt;! -- various controls --&gt;
    &lt;input type="submit" onclick="form1.action='form1.php';" /&gt;
    &lt;input type="submit" onclick="form1.action='http://server.anotherdomain/form';" /&gt;
    &lt;input type="submit" onclick="form1.action='form2.php'; return true;" /&gt;
  &lt;/form&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>form2.php</p>
  
  <pre><code>&lt;?php
    session_start();
    $form1Var = $_SESSION["form1Var"];
    /* etc. */
  ?&gt;  
  &lt;html&gt;
  &lt;head&gt;&lt;/head&gt;
  
  &lt;body&gt;
  
  &lt;form action="form2.php" method="post"&gt;
    &lt;input type="hidden"  value="&lt;?php echo $form1Var?&gt;" /&gt;
  &lt;/form&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>