PHP Notice: Undefined index: How to fix


#1

So I had this code that showed the user’s information. Everything worked fine but for some reason i get these error messages now. Does anyone know how to resolve this.

PHP Notice: Undefined index: u_first in G:\PleskVhosts\website.co.uk\httpdocs\profile.php on line 118
PHP Notice: Undefined index: u_first in G:\PleskVhosts\website.co.uk\httpdocs\profile.php on line 145
PHP Notice: Undefined index: u_last in G:\PleskVhosts\website.co.uk\httpdocs\profile.php on line 147
PHP Notice: Undefined index: u_email in G:\PleskVhosts\website.co.uk\httpdocs\profile.php on line 149
PHP Notice: Undefined index: u_uid in G:\PleskVhosts\website.co.uk\httpdocs\profile.php on line 151

Here is my Full code:

<?php session_start(); ?> Snappy
<link href="img/favion.ico" rel="shortcut icon">
<link href="img/apple-touch-icon.png" rel="apple-touch-icon">
<link href="img/apple-touch-icon-72x72.png" rel="apple-touch-icon" sizes="72x72">
<link href="img/apple-touch-icon-144x144.png" rel="apple-touch-icon" sizes="114x114">
<link href="img/apple-touch-icon-144x144.png" rel="apple-touch-icon" sizes="114x114">

<link rel="stylesheet" href="bootstrap.css">
<link rel="stylesheet" href="styles.css">
<link href="https://fonts.googleapis.com/css?family=Quicksand" rel="stylesheet">
<link href="http://cdnjs.cloudflare.com/ajax/libs/normalize/3.0.1/normalize.css" rel="stylesheet" type="text/css">
<link href="http://netdna.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet" type="text/css">

<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.min.css">

<link href="http://netdna.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<header class="header">
    <div>
<figure class="logo--main">
  <a href="#">
    <img src=img/Logo_2_Design.png  width="80"/>
  </a>
</figure>
<figure class="logo--sticky">
    <a href="#">
    <img src=img/Logo_2_Design_white_black.png   width="80"/>
    </a>
</figure>
</div>
<div class="collapse navbar-collapse" id="myNavbar">
  <ul class="nav navbar-nav">
    <li class="active"><a href="index.php">Home</a></li>
   
    <li><a href="explore.php">Explore</a></li>
    <li><a href="community.php">Community</a></li>
    <li><a href="signup.php">Sign Up</a></li>
    <li><a href="login.php">Login</a></li>
        <li><a href="help.php">Help</a></li>

  </ul>
    
    <input type="text" placeholder="Search..">

 
</div>
<header class="masthead">
</header>

     <?php
    {

       
        echo  "<h1 style='color:#a1917c;'> Welcome to Snappy "  .$_SESSION['u_first'] . "</h1";
    }
    ?>



<section class="yourprofile">
    <h1 class="heading">Your Profile</h1>
    
    
    
    
    
    <div class="logoutbutton">
    <a href="login.php">Logout Here</a>
    </div>

</section>




    <?php
    {


        echo '<br>';
        echo  "<p style='text-align:center;'> First Name&#58 "  .$_SESSION['u_first'] . "</p";
        echo '<br>';
        echo  "<p style='text-align:center;'>Surname&#58 "  .$_SESSION['u_last'] . "</p";
        echo '<br>';
        echo  "<p style='text-align:center;'>Email&#58 "  .$_SESSION['u_email'] . "</p";
        echo '<br>';
        echo  "<p style='text-align:center;'>Username&#58 "  .$_SESSION['u_uid'] . "</p";
        echo '<br>';
       

    }

    ?>


 <section class="submitphoto">
    <h1 class="heading">Submit A Photo</h1>


     <form action="upload.php" method="post" enctype="multipart/form-data">
Select image to upload: <br><br>
<input type="file" name="fileToUpload" id="fileToUpload"> <br>
<input type="submit" value="Upload Image" name="submit">
</section> 

</body>

#2

Please Ignore fixed the solution. Had noticed that i had blocked cookies on my site