php - How to solve undefine index? -


how solve undefined index although have started session in top of header file shows undefined index?

the following error shown:- notice: undefined index: signed_in in c:\xampp\htdocs\web_forum\header.php on line 26

line 26

if($_session['signed_in']) 

header.php

<?php session_start(); ?> <!doctype html> <html> <head>     <meta charset="utf-8"/>     <meta name="description" content="a short description."/>     <meta name="keywords" content="put, keywords, here"/>     <title>webinar</title>     <link rel="stylesheet" type="text/css" href="css/style.css"> </head> <body>     <h1>webinar</h1>          <div id="wrapper">             <div id="menu">                 <a class="item" href="index.php">home</a> -                 <a class="item" href="create_topic.php">create topic</a> -                 <a class="item" href="create_cat.php">create category</a>                    <div id="userbar">                 <?php         if($_session['signed_in'])         {             echo 'hello <b>' . htmlentities($_session['user_name']) . '</b>. not you? <a class="item" href="signout.php">sign out</a>';         }         else         {             echo '<a class="item" href="signin.php">sign in</a> or <a class="item" href="signup.php">create account</a>';         }         ?>                             </div>                  </div>                 <div id="content"> 

footer.php

</div><!--content-->          </div><!--wrapper-->          <div id="footer">created webinar swastik shrestha.</div>  </body> </html> 

you should use isset() method this:

if(isset($_session['signed_in'])) { ... } 

hope helps!


Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -