declaring session variables php -


is not mandatory use session_start() before using session variables in php? tried following piece of code without declaring session_start() @ beginning, worked fine.

so, i'm confused. please !!!!

also, did not use $_post or $_get pass $uname home.php, still how work? if use include 'home.php' treat login.php , home.php same page?

// code login.php// <? require_once 'db_connect.php'; if (isset($_session ['user_id']) && !empty($_session ['user_id'])) { $u_name = $_session['user_name']; include 'home.php'; } else { //some stmt } ?> /*******home.php file ****/ <?php require_once 'dbconnect.php'; $_session['username'] = $u_name; //echo $_session['username']; //blah blah ?> 

you need it, if session.autostart not set in php.ini. know then.

do not call in db_connect.php? also, i'm pretty sure wouldn't errors, session empty.


Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -