CodeIgniter Forums
session not working? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: session not working? (/showthread.php?tid=75535)



session not working? - adscbe - 02-18-2020

Login.php
-------------

i stored the value
PHP Code:
$_SESSION['logvalue']="89"

Redirect.php
---------------
PHP Code:
echo " -  - "$_SESSION['logvalue']; 


This is working on local Apache server. but not working on PLESK and 000Webhost..?
Code:
A PHP Error was encountered
Severity: Notice
Message: Undefined index: logvalue


Thanks..


RE: session not working? - mjamilasfihani - 02-18-2020

Why you just not using :

Code:
$this->session->set_userdata()
 
Or for CI4

Code:
$session->set()

Before it you must call the session library.


RE: session not working? - stlake2011 - 02-23-2020

(02-18-2020, 07:59 PM)mjamilasfihani Wrote: Why you just not using :

Code:
$this->session->set_userdata()
 
Or for CI4

Code:
$session->set()

Before it you must call the session library.


Both ways work the same as i understand it, only difference between them being the CI session library has helper functions that makes things easier to do/work with.
 
In my case, I personally prefer pushing/deleting all my values to/from the $_SESSION variable (the way I learned way back in '03) and use the CI helper functions as needed.