crunchie Posted April 20, 2012 Share Posted April 20, 2012 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 https://forums.phpfreaks.com/topic/261332-noob-question-re-sessions-and-forms/ Share on other sites More sharing options...
Drummin Posted April 20, 2012 Share Posted April 20, 2012 SESSION_START(); Should be lower case. session_start(); You echos should not have = post echo $_SESSION['first']; Link to comment https://forums.phpfreaks.com/topic/261332-noob-question-re-sessions-and-forms/#findComment-1339180 Share on other sites More sharing options...
crunchie Posted April 20, 2012 Author Share Posted April 20, 2012 Thank you Drummin. I knew it was going to be something stupidly simple but I just couldn't see it. Link to comment https://forums.phpfreaks.com/topic/261332-noob-question-re-sessions-and-forms/#findComment-1339181 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.