Re: session not working

From: Date: Thu, 27 Sep 2001 15:59:51 +0000
Subject: Re: session not working
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-69018@lists.php.net to get a copy of this message
thanks for clarifying my misconcept. /sagar ----- Original Message ----- From: Tamas Arpad To: php Sent: Thursday, September 27, 2001 7:55 PM Subject: Re: [PHP] session not working On Thursday 27 September 2001 14:36, sagar N Chand wrote: > session must be registered before any code is sent to the browser. no, they needn't be registered before, only session_start() should be before any output or if you don't use sessin_start(), then the above is only true for the first session_register() because it calls session_start() implicitly. Check if session.save_path is set to an existing dir, and set error_reporting to E_ALL. I think most of the times the save_path directory causes the problem. Arpi > so the syntax should be <?session_start(); > session_register("uname"); > session_register("pwd"); > ................. > .................... > .................... > ?> > <HTML> > <body bgcolor="#ffffff"> > html code here > > > /sagar > > ----- Original Message ----- > From: Krushna Kumar R > To: php-general@lists.php.net > Sent: Thursday, September 27, 2001 5:43 PM > Subject: [PHP] session not working > > > 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#69018) next »