RE: PHP No Session

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



You need to call
session_start();
On any page that you wish to access the $_SESSION global array from.

Working from your example below.
1.
call session_start()  before you set the session variable on page 1.
    (I have heard some people say that it is not necessary to do this as the
$_SESSION is a global array, however, I have had difficulties when I went
with this option so I think it is better to call start_session();

You do not need to call session start on page2, however, unless you do you
are not able to access the $_SESSION array

On page 3, call session_start() and then you will be able to access the
$_SERVER array.

This snippet of code allows you to inspect your session variables.

<?php

foreach ($_SESSION as $key=>$val){
echo "SESSION:: $key :: $val<br>";
}
?>


Brian U

www.phpcontractor.net

-----Original Message-----
From: Tech @ LDS [mailto:tech@litigationdataservices.com]
Sent: 19 July 2004 15:34
To: php-objects@yahoogroups.com
Subject: Re:  PHP No Session


Bimal Pouldel wrote:
> Friends,
>
> Does a PHP page still holds the session information that was set
> in the previous page but not in the current page.
>
> Will Page 2 pass the pass the sessions of page 1 to page 3 if
> page 1 sets php sessions, page 2 is not doing so, but is
> referred by page 1, and page 3 is trying to retrive the sessions
> of page 1, that was reffered by page 2?
>
> [page 1]: sets sessions
>   Links page 2.
>
> [page 2]: idle
>   Links page 3
>
> [page 3]: retrives session.
>
> Please tell me how is this maintained.
>
PHP holds session in the $_SESSION global array, it's not magically held
in the page. Once it's in there, unless you destroy the session, it's in
there. There are TONS of tutorials on session management online.


PHP Data object relational mapping generator - http://www.meta-language.net/


Yahoo! Groups Sponsor
ADVERTISEMENT






Yahoo! Groups Links

To visit your group on the web, go to:
http://groups.yahoo.com/group/php-objects/

To unsubscribe from this group, send an email to:
php-objects-unsubscribe@yahoogroups.com

Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/saFolB/TM
--------------------------------------------------------------------~-> 

PHP Data object relational mapping generator - http://www.meta-language.net/ 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-objects/

<*> To unsubscribe from this group, send an email to:
    php-objects-unsubscribe@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux