Retrieve Session

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

New php-forum User
New php-forum User
Posts: 1
Joined: Sun Feb 24, 2013 7:12 am

Retrieve Session

Postby trixdhy » Sun Feb 24, 2013 7:59 am


i want to know, how do I take the value of the session which is the session sent by cake php, and here is a sample code i try :

* Code in CakePhp :

// Set Session in cakephp
$this->Session->write('ThisSession', 'This Content');
//Code above is set session with name/id "ThisSession" with value "This is Content"

i want to retrieve that session value in another php pages, outside of cakephp with this code

//php file : getvalue.php
echo $_SESSION('ThisSession');

but i got nothing, can anyone help me about this solution, pleasee !

php-forum Fan User
php-forum Fan User
Posts: 973
Joined: Mon Oct 01, 2012 12:32 pm

Re: Retrieve Session

Postby seandisanti » Mon Feb 25, 2013 9:14 am

Code: Select all

echo $_SESSION['ThisSession'];

also make sure that you're starting your session on pages that that need it. here's quick video tutorial on sessions that helped me out a lot when i first started using them ... e-security

Return to “PHP coding => General”

Who is online

Users browsing this forum: Baidu [Spider] and 6 guests