<?php session_start();
if (!isset($_session['mySession'])) {
$_session['mySession'] = 'mySess';}
echo $_session['mySession'];
$_session['mySession']='mySessSet';
?>
I have the code above at http://dot.kr/x-test/IFsession1.php .
IF mySession is not set(When I open the file), the value of mySession will be ‘mySess’ (It will print “mySess” on my browser).
IF mySession is set (When I refresh the file), the value of mySession will be “mySessSet” because mySession is already set (It should print “mySessSet”).
But The result is not what I expected.
Although I reflesh the page, it prints just “mySess” instead of “mySessSet”.
What’s wrong in my code?
(I want that it prints “mySess” when I open the file for the first time and it prints “mySessSet” when I open the file for the second time.)