lilywong Posted July 27, 2006 Share Posted July 27, 2006 i am using the old session syntax to create the session, it works fine in index.php, but while i click a hyperlink to page2, the session is gone, where when i echo nothing comes out, usually what kind of problem is it ? thanks Link to comment https://forums.phpfreaks.com/topic/15788-php-session-help/ Share on other sites More sharing options...
hackerkts Posted July 27, 2006 Share Posted July 27, 2006 Make sure you had put[code]session_start();[/code]on the other pages too. Link to comment https://forums.phpfreaks.com/topic/15788-php-session-help/#findComment-64557 Share on other sites More sharing options...
lilywong Posted July 28, 2006 Author Share Posted July 28, 2006 i did this, but no print out comes out.//register session$user = $this_user;echo $user;the echo print out Object id #2 when i do this//register session$user = $this_user;echo $user->domainName;the echo can print out the domainName, for eg, homeHosting Link to comment https://forums.phpfreaks.com/topic/15788-php-session-help/#findComment-64932 Share on other sites More sharing options...
legohead6 Posted July 28, 2006 Share Posted July 28, 2006 Pg 1[code]SESSION_START();$_SESSION['user']="$variable";[/code]pg 2[code]SESSION_START();$user=$_SESSION['user'];echo "$user";[/code]is that what you have? Link to comment https://forums.phpfreaks.com/topic/15788-php-session-help/#findComment-64934 Share on other sites More sharing options...
lilywong Posted July 28, 2006 Author Share Posted July 28, 2006 [quote author=legohead6 link=topic=102045.msg404886#msg404886 date=1154052078]Pg 1[code]SESSION_START();$_SESSION['user']="$variable";[/code]the $variable i have is not a defined variable, it is an object, and point to a class file to get the data. in pg1, if i echo echo $user->UserName, it just work fine. when i click to pg2, and echo the same thing, nothing comes out!if i simply define $_SESSION['user']="test";, and i echo $_SESSION['user'] in pg2, it just works fine. Link to comment https://forums.phpfreaks.com/topic/15788-php-session-help/#findComment-64940 Share on other sites More sharing options...
legohead6 Posted July 28, 2006 Share Posted July 28, 2006 while i just put $variable there so you could replace it i wasnt going to make a whole form...just getting the main idea basicly Link to comment https://forums.phpfreaks.com/topic/15788-php-session-help/#findComment-64942 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.