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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.