Jump to content

Storing a $_POST in a $_SESSION Not working


aeboi80

Recommended Posts

I am having problems storing a $_POST variable from a form into a $_SESSION.  When I go to the next page and echo out the $_SESSION variable its blank

 

Page 1 code (page with self submitting form action)

 

<?php
session_start();

$email = $_POST['email];
$_SESSION['email'] = $email;
?>

 

Page 2 (page which should be echoing out the value of the session variable)

<?php
session_start();
echo "Your Email Address which you submitted was: " . $_SESSION['email'];
?>

 

When I echo that out on page 2 its blank

 

Why is the variable value not carrying over to the 2nd page?

 

Chad

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.