PHP: store input variable in session and then echo it on a page is not working
<p>Ok im going to try to explain this:</p>

<p>I have a php page "index.php" where there is a form that posts to a form.php?form=1 that processes the data and then redirects in a split second to a "thank you" page called "paso2.php"</p>

<p>What im trying to do is store the email variable on a session and then echo it on paso2.php</p>

<p>SO i did this at the very top of form.php:</p>

<pre><code>&lt;?php error_reporting(-1);
ini_set('display_errors', 1);
session_start();
// Validation here...
$_SESSION['email_address'] = $_POST['email'];
</code></pre>

<p>"email" is the name of the email input on index.php</p>

<p>Then on paso2.php i did this at the very top:</p>

<pre><code>&lt;?php
error_reporting(-1);
ini_set('display_errors', 1);
session_start();?&gt;
</code></pre>

<p>and then inside the input on paso2.php i echo the value</p>

<pre><code>&lt;input type="text" name="email2" value="&lt;?php echo htmlspecialchars($_SESSION['email_address']);?&gt;" /&gt; 
</code></pre>

<p>But its not working! the error i can read inside that value is:</p>

<p>inside the value </p>

<pre><code>&lt;br /&gt; &lt;b&gt;Notice&lt;/b&gt;: Undefined index: email_address in     &lt;b&gt;/home/gulp1986/public_html/cupon0km.com/paso2.php&lt;/b&gt; on line &lt;b&gt;59&lt;/b&gt;&lt;br /&gt;
</code></pre>

<p>Can anyone tell me what am i doing wrong to post this value?</p>
