0

How can I add value in drupal session. I am adding value using $_SESSION = 'my value', but once trying to print $_SESSION variable it return blank.

  • It has to be an array. Collins' answer looks right. – Niall Murphy Aug 26 '16 at 6:37
2

Drupal bootstrap takes care of session_start for you, so you should be able to define sessions like...

$_SESSION['my_data'] = 'my value';

You can also add the following in settings.php to determine the life span of the session

ini_set('session.cache_expire',     200000);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.