php - Session Values are not coming -


i have homepage.php , messages.php page both common "menu.php" there have started session in homepage.php messages.php , have not started session in menu page. trying these values here menu code:

html code:

<a href="#" class="dropdown-toggle dropdown-at" data-toggle="dropdown">     <span class=" name-caret">         <?= $_session['name'] ?><i class="caret"></i>     </span>     <img src="../images/user/<?= $_session['image'] ?>" style="width:100px; height: 61px;"> </a> 

home page.php

<?php ob_start(); session_start(); if (!isset($_session['id'])) {     header('location:index.php'); } include_once('includes/config.php'); include_once('includes/header.php'); include_once('includes/menu.php');  ?> 

so can show login user data of name , image on menu both homepage , messages page.

you need use echo in php show values. this:

<a href="#" class="dropdown-toggle dropdown-at" data-toggle="dropdown">   <span class=" name-caret"><?php echo $_session[name]; ?>     <i class="caret"></i>   </span>   <img src="../images/user/<?php echo $_session[image]; ?>" /> </a> 

Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -