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
Post a Comment