Strange PHP bug with sessions
<p>I'm trying to load a <code>$_SESSION</code> variable with another variable on a page of mine.</p>

<p>The page structure here is Page 1 -> Page 2 -> Page 3; it is a multi-part form. There is a back button on Page 2 that allows you to go back to Page 1. I'm trying to use session variables to keep the input fields in Page 1 from going blank.</p>

<p>I use a form submit to go from Page 1 to Page 2. Here is the applicable PHP code on Page 2 that handles retrieving POST variables:</p>

<pre><code>    &lt;?php
$retailerName = $_POST["retailerName"];
$description = $_POST["description"];
$savingsDetails = $_POST["savingsDetails"];
$terms = $_POST["terms"];
$phone = $_POST["phone"];
$address = $_POST["address"];
$zone = $_POST["zone"];
$dateExp = $_POST["dateExp"];
$tag = $_POST["tag"];

$_SESSION["rn"] = $retailerName;
$_SESSION["de"] = $description;
$_SESSION["sd"] = $savingsDetails;
$_SESSION["tm"] = $terms;
$_SESSION["ph"] = $phone;
$_SESSION["ad"] = $address;
$_SESSION["zo"] = $zone;
$_SESSION["ex"] = $dateExp;
$_SESSION["tg"] = $tag;
?&gt;
</code></pre>

<p>I know that the variables are being set properly.</p>

<p>I can do this:</p>

<pre><code> echo $retailerName;
 echo $_SESSION["rn"];
</code></pre>

<p>On Page 2 and it will show what I want. The only problem is that the session variables won't carry over to Page 1.</p>

<p>If I set the session variables to a string, it will carry back to Page 1. For some reason, even though the posted variables are valid and contain the proper string, the session variable won't carry them over.</p>

<p>If I do this:</p>

<pre><code> $_SESSION["rn"] = $retailerName;
</code></pre>

<p>Then the session variable's value will not carry over to Page 1.</p>

<p>If I do this:</p>

<pre><code> $_SESSION["rn"] = "asdf";
</code></pre>

<p>Then the session variable's value will carry over to Page 1.</p>

<p>Normally, this just means my posted variables are bad, but in this case I know that they work, since the rest of the page is dedicated to outputting the posted variables, and it does so correctly.</p>

<p>The SESSID stays the same, so that's not the problem. I also am able to carry over other session variables in other parts of the website, and they work perfectly.</p>

<p>Why is it that the <code>$_SESSION</code> variables will not carry over a proper and valid posted variable to Page 1, but it will carry over a string?</p>

<h1><a href="http://pastebin.com/VkumVtrf" rel="nofollow">Page 1 Pastebin</a></h1>

<h1><a href="http://pastebin.com/ptK1QEcV" rel="nofollow">Page 2 Pastebin</a></h1>
