Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

Retrieve Session

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Retrieve Session

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

Hello,

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
session_start();
echo $_SESSION('ThisSession');

but i got nothing, can anyone help me about this solution, pleasee !
trixdhy
New php-forum User
New php-forum User
 
Posts: 1
Joined: Sun Feb 24, 2013 7:12 am

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 http://jream.com/learning/videos/php-ba ... e-security
seandisanti
php-forum Fan User
php-forum Fan User
 
Posts: 838
Joined: Mon Oct 01, 2012 12:32 pm


Return to PHP coding => General

Who is online

Users browsing this forum: Google Feedfetcher, Yahoo [Bot] and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.