Re: session not working

From: Date: Thu, 27 Sep 2001 12:17:29 +0000
Subject: Re: session not working
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-68988@lists.php.net to get a copy of this message
try putting all your session_register's above any html and see if that works. I believe you need to do this before any html is output. It's been awhile since I've worked with sessions, but try it :) Rick > Hi, > > I wrote a program where the session gets created, but on subsequent page the > session does not work or i could not retrieve the value kindly help me, I have > put the coding below > > The operating system I use is Win98 and Personal Web Server, PHP version used > is 4.0.6 > > File 1 : where the session is registered or created > > <?session_start();?> > <HTML> > <body bgcolor="#ffffff"> > <?php > > session_register("uname"); > session_register("pwd"); > print "Username var is - ". $username."<br>"; > print "Password var is - ". $password."<br>"; > $uname=$username; > $pwd=$password; > print "Uname var is - ". $uname."<br>"; > print "Pwd var is - ". $pwd."<br>"; > > echo session_is_registered("uname"); > echo session_name("uname"); > ?> > <a href="file2.php">click here to go to next page</a> > </body> > </HTML> > > > File 2 : Next page, the file where i check for the session variable's value > > <?session_start(); > print "uname is - ".$uname."<br>"; > echo "Session is - ".session_is_registered("uname")."<br>"; > echo "session name is - ". session_name("uname")."<br>"; > echo "the session is $uname"."<br>"; > ?> > <a href="last.php">click here go to last page</a> > > Those are the coding i had used on the files i was trying to execute > > Regards > Krushna Kumar >

« previous php.general (#68988) next »