• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Undefined variable: _SESSION

#1
[eluser]jonnyjon[/eluser]
When I try to use the $_SESSION var I get:

Undefined variable: _SESSION

Does CI do something with the _SESSION var?

#2
[eluser]jonnyjon[/eluser]
Figured it out.

Turns out you need make sure to start the session:

session_start();

#3
[eluser]Matthew Lanham[/eluser]
check out:

http://ellislab.com/codeigniter/user-gui...sions.html

#4
[eluser]Unknown[/eluser]
I'm having the same problem, which is 'Notice: Undefined variable: user_name in c:\Inetpub\wwwroot\nssu2\main_admin.html on line 62'.

This are a few things that i have done to solve my problem, which it will work for you too.

First, on php.ini, you have to activate the ;error_reporting = E_ALL & ~E_NOTICE. Remove ; from error_reporting.

Second, i used echo "<srcipt type=text/javascript>location.href='main_admin.html'</srcipt>"; instead of header("Location: main_admin.html");

Example:

$_SESSION['AUTH'] = TRUE;
$_SESSION['USERNAME'] = $_POST['USERNAME'];
$_SESSION['CAMPUS'] = $_POST['CAMPUS'];
$_SESSION['LOGON'] = date("M d Y H:iConfused");

echo "<srcipt type=text/javascript>location.href='main_admin.html'</srcipt>";

ps: please replace srcipt to script. Cause it bcome a problem when i try to post this msg here.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.