paulman888888 Posted July 18, 2008 Share Posted July 18, 2008 Hi. I am new to sessions and would like to learn about it. Reason being i would like to some script that puts $_POST[] into a session. Thankyou Paul Link to comment https://forums.phpfreaks.com/topic/115470-sessions/ Share on other sites More sharing options...
Guest Xanza Posted July 18, 2008 Share Posted July 18, 2008 read here endless information. Link to comment https://forums.phpfreaks.com/topic/115470-sessions/#findComment-593592 Share on other sites More sharing options...
paulman888888 Posted July 18, 2008 Author Share Posted July 18, 2008 so do sessions automaticly go to the next page? Link to comment https://forums.phpfreaks.com/topic/115470-sessions/#findComment-593603 Share on other sites More sharing options...
kenrbnsn Posted July 18, 2008 Share Posted July 18, 2008 You need to put <?php session_start(); ?> at the start of each script where you want to use sessions. Ken Link to comment https://forums.phpfreaks.com/topic/115470-sessions/#findComment-593610 Share on other sites More sharing options...
HelpMe1985 Posted July 18, 2008 Share Posted July 18, 2008 you can post stuff over from other pages if thats what your getting at ? Link to comment https://forums.phpfreaks.com/topic/115470-sessions/#findComment-593616 Share on other sites More sharing options...
paulman888888 Posted July 18, 2008 Author Share Posted July 18, 2008 Just to clarify. Page 1 <?php session_start(); //then loads of session stuff ?> Page 2 <?php session_start(); //the session variables has been past on from page 1 ?> Page 3 <?php session_start(); //will the variables from Page 2 still come though to this Page? ?> Thankyou Paul Link to comment https://forums.phpfreaks.com/topic/115470-sessions/#findComment-593617 Share on other sites More sharing options...
Lautarox Posted July 18, 2008 Share Posted July 18, 2008 When you start a session on the page, it loads automatically the $_SESSION array with the values you gave it, if the session is still alive.. so it will load the session values in the 3rd page Link to comment https://forums.phpfreaks.com/topic/115470-sessions/#findComment-593647 Share on other sites More sharing options...
kenrbnsn Posted July 18, 2008 Share Posted July 18, 2008 The $_SESSION array will contain everything that you put into it from which ever script. It's cumulative. By default the session goes away when you close the browser. Try these three scripts: one.php <?php session_start(); echo '<pre>' . print_r($_SESSION,true) . '</pre>'; if (isset($_SESSION['one'])) $_SESSION['one']++; else $_SESSION['one'] = 1; ?> two.php <?php session_start(); echo '<pre>' . print_r($_SESSION,true) . '</pre>'; if (isset($_SESSION['two'])) $_SESSION['two']++; else $_SESSION['two'] = 1; ?> three.php <?php session_start(); echo '<pre>' . print_r($_SESSION,true) . '</pre>'; if (isset($_SESSION['three'])) $_SESSION['three']++; else $_SESSION['three'] = 1; ?> Invoke them in any order in the same browser and see how the $_SESSION array changes. Ken Link to comment https://forums.phpfreaks.com/topic/115470-sessions/#findComment-593657 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.