Jump to content

noob question re: sessions and forms


crunchie

Recommended Posts

I'm almost embarrassed to ask such a simple question but I just cannot get this to work.  I'm trying to figure out how to use sessions  that takes the information from a form on the first page and displays it on the last.

I have this on page 1:

<?php

session_start();

?>

<form action="test2.php" method="post">

<p>Page 1</p>

<p>First Name <input type="text" name="first" /></p>

 

<p><input type="submit" value="Next page 2"  /></p>

 

And this for page 2:

<?php

SESSION_START();

 

$_SESSION['first'] = $_POST['first'];

echo $_SESSION['first'] = $_POST['first'];

 

?>

<form action="test3.php" method="post">

<p>Page 2</p>

<input type="submit" value="Next page 3" />

</form>

 

And this for page 3:

<?php

SESSION_START();

 

$_SESSION['first'] = $_POST['first'];

echo $_SESSION['first'] = $_POST['first'];

 

?>

 

<p>Page 3</p>

<p>You're done</p>

 

I can get it to display on page 2 but not on page 3.  Can anyone tell me why?  I've been at this for a long time and it should be simple but I cannot get it to work.  Thanks in advance.

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.