sfx81 Posted June 25, 2008 Share Posted June 25, 2008 hi. I am trying to passon data using session from one page to another but not having any luck. At top of page one im doing this page1.php <?php session_start(); $_SESSION['referrer'] = $_SERVER['REQUEST_URI']; ?> and in page2.php at very top <?php echo "Referrer = ".$_SESSION['referrer']; ?> Basically I want to use 'referrer' to send user back to previous page. I assume that I only have to call session_start() just once in page1 . I am using wamp, apache 2.2.8 , php 5.2.6, Windows Vista Please correct me as what I am doing wrong. Any help will be appreciated. Cheers Quote Link to comment https://forums.phpfreaks.com/topic/111933-solved-session-help/ Share on other sites More sharing options...
.josh Posted June 25, 2008 Share Posted June 25, 2008 you have to put session_start(); on every page that wants to use session variables, and it must come before you try to use them. Quote Link to comment https://forums.phpfreaks.com/topic/111933-solved-session-help/#findComment-574500 Share on other sites More sharing options...
PFMaBiSmAd Posted June 25, 2008 Share Posted June 25, 2008 I assume that I only have to call session_start() just once in page1 In programming ASSUME means: To make an ASS out of U and ME. Don't assume anything in programming. Read the manual. The examples under both the Session Handling section and under the session_start() function show how to use them. Quote Link to comment https://forums.phpfreaks.com/topic/111933-solved-session-help/#findComment-574503 Share on other sites More sharing options...
DarkWater Posted June 26, 2008 Share Posted June 26, 2008 I assume that I only have to call session_start() just once in page1 In programming ASSUME means: To make an ASS out of U and ME. Don't assume anything in programming. Read the manual. The examples under both the Session Handling section and under the session_start() function show how to use them. Actually, that's what it means to The Odd Couple. =) Quote Link to comment https://forums.phpfreaks.com/topic/111933-solved-session-help/#findComment-574546 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.