PHP session value defined in one file, is undefined in another file -


i have 2 php files, in first file:

    <?php         session_start();     . . .         $_session['favcolor'] = "green";         echo "ses: ".$_session['favcolor'];     ?> 

and in second file:

<?php     session_start();     echo "ses: ".$_session['favcolor']; ?> 

when executing first page, see correct favcolor when executing second page in same browser, {"error":"undefined index: favcolor"}. know need check existence of key before using wondering why it's not there in first place because want achieve, store/restore session value between php calls. missing?


Comments

Popular posts from this blog

php - Zend Framework / Skeleton-Application / Composer install issue -

c# - Better 64-bit byte array hash -

python - PyCharm Type error Message -