title: Display username with cookies
body: <p>I have created a connection between php and mysql ,and i added a username and password on mysql table so i can login and redirect to a "members" page. It works at this point but what i want to do is to display "username" in some places in my "members" page with cookies.</p>
  
  <p>On first.php , on navbar, blockquote where it says "User" thats where i want to replace it with the username that logins but with cookies and i haven't understood how to do it</p>
  
  <p>My files: </p>
  
  <p>config.php </p>
  
  <pre><code>&lt;?php
      $mysql_hostname="localhost";
      $mysql_user="root";
      $mysql_password="root";
      $mysql_database="Electricians";
  
      $bd=mysql_connect($mysql_hostname,$mysql_user,$mysql_password)or   die("Bad Connection");
      mysql_select_db($mysql_database,$bd)or die("Bad Connection");
      ?&gt;
  </code></pre>
  
  <p>index.php </p>
  
  <pre><code>&lt;?php
      header("location:login.php");
  ?&gt;
  </code></pre>
  
  <p>login.php</p>
  
  <pre><code>&lt;?php
      session_start();
      include("includes/config.php");
  
      if($_SERVER["REQUEST_METHOD"]=="POST")
  {
  
      $myusername=addslashes($_POST ['username']);
      $mypassword=md5(addslashes($_POST[ 'password']));
  
  
  
  $sql="SELECT userid FROM users WHERE username='$myusername' and password='$mypassword'";
  
  $result=mysql_query($sql);
  $count=mysql_num_rows($result);
  
  if($count==1)
  {
  
      $_SESSION['login_admin']=$myusername;
  
      header("location:http://localhost:8888/offlineproject/first.php");
  
  }
  }   
      ?&gt;
  
      &lt;!DOCTYPE html&gt;
  &lt;html&gt;
   &lt;head&gt;
       &lt;meta charset="UTF-8"&gt; 
       &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt;
       &lt;meta http-equiv="X-UA-Compatible" content="IE=edge"&gt;
      &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt;                 
       &lt;link rel="stylesheet" type="text/css" href="css/theme.css"&gt;
       &lt;link rel="stylesheet" type="text/css" href="css/bootstrap.css"&gt;
       &lt;link rel="stylesheet" type="text/csc" href="css/bootstrap-glyphicons.css"&gt;
       &lt;link rel="stylesheet" type="text/csc" href="css/login.css"&gt;
    &lt;title&gt;Online Drawing for Electricians&lt;/title&gt;
   &lt;/head&gt;                 
   &lt;body&gt;             
       &lt;nav class="navbar navbar-inverse navbar-fixed-top" role="navigation"&gt;
          &lt;div class="container"&gt;
              &lt;div class="navbar-header"&gt;
              &lt;button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-collapse"&gt;
              &lt;span class="icon-bar"&gt;&lt;/span&gt;
              &lt;span class="icon-bar"&gt;&lt;/span&gt;   
              &lt;span class="icon-bar"&gt;&lt;/span&gt;   
              &lt;span class="icon-bar"&gt;&lt;/span&gt;       
                  &lt;/button&gt;              
              &lt;/div&gt;
  
               &lt;div class="navbar-header"&gt;
                   &lt;a class="navbar-brand" href="#"&gt;&lt;img id="logoattop" src="images/nklogo.png" alt="Logo" &gt;Online Drawing for Electricians &lt;/a&gt;
        &lt;/div&gt;
  
  
          &lt;/div&gt;
        &lt;/nav&gt;&lt;
        &lt;div class="jumbotron"&gt;
        &lt;div class="container text-center"&gt;
              &lt;h1&gt;Online Drawing for Electricians&lt;/h1&gt;
                  &lt;div class="container"&gt;
        &lt;form class="form-signin" method="post"&gt;
              &lt;h2 class="form-signin-heading"&gt;Please sign in&lt;/h2&gt;
              &lt;label for="inputEmail" class="sr-only"&gt;Email address&lt;/label&gt;
              &lt;input name="username" type="email" id="inputEmail" class="form-control" placeholder="Email address" required autofocus&gt;
              &lt;label for="inputPassword" class="sr-only"&gt;Password&lt;/label&gt;
              &lt;input name="password" type="password" id="inputPassword" class="form-control" placeholder="Password" required&gt;
          &lt;button class="btn btn-lg btn-primary btn-block" type="submit"&gt;Sign in&lt;/button&gt;
        &lt;/form&gt;
               &lt;/div&gt;
             &lt;a href="first.php"&gt;Skip&lt;/a&gt;
          &lt;/div&gt;
          &lt;/div&gt;
  &lt;!-- jQuery (necessary for Bootstrap's JavaScript plugins) --&gt;
      &lt;script src="js/jquery-2.1.3.min.js"&gt;&lt;/script&gt;
      &lt;!-- Include all compiled plugins (below), or include individual files as needed --&gt;
      &lt;script src="js/bootstrap.min.js"&gt;&lt;/script&gt;
  
   &lt;/body&gt;                 
  &lt;/html&gt;
  </code></pre>
  
  <p>first.php</p>
  
  <pre><code>&lt;!Doctype html&gt;
  &lt;html&gt;
   &lt;head&gt;
       &lt;meta charset="UTF-8"&gt; 
       &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt;
       &lt;meta http-equiv="X-UA-Compatible" content="IE=edge"&gt;
      &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt;                 
       &lt;link rel="stylesheet" type="text/css" href="css/theme.css"&gt;
       &lt;link rel="stylesheet" type="text/css" href="css/bootstrap.css"&gt;
       &lt;link href="css/bootstrap-glyphicons.css"rel="stylesheet"&gt;
    &lt;title&gt;Online Drawing for Electricians&lt;/title&gt;
   &lt;/head&gt;                 
   &lt;body&gt;             
       &lt;nav class="navbar navbar-inverse navbar-fixed-top" role="navigation"&gt;
          &lt;div class="container"&gt;
              &lt;div class="navbar-header"&gt;
              &lt;button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-collapse"&gt;
              &lt;span class="icon-bar"&gt;&lt;/span&gt;
              &lt;span class="icon-bar"&gt;&lt;/span&gt;   
              &lt;span class="icon-bar"&gt;&lt;/span&gt;   
              &lt;span class="icon-bar"&gt;&lt;/span&gt;       
                  &lt;/button&gt;              
              &lt;/div&gt;
              &lt;!navbar header--&gt;
               &lt;div class="navbar-header"&gt;
                   &lt;a class="navbar-brand" href="#"&gt;&lt;img id="logoattop" src="images/nklogo.png" alt="Logo" &gt;Online Drawing for Electricians &lt;/a&gt;
        &lt;/div&gt;
                 &lt;div class="collapse navbar-collapse" id="navbar-collapse"&gt;
          &lt;ul class="nav navbar-nav navbar-right"&gt;
          &lt;li&gt;&lt;a href=#&gt;&lt;span class="glyphicon glyphicon-user"&gt;&lt;/span&gt; &lt;User&gt;&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href="/offlineproject/logout.php"&gt;&lt;span class="glyphicon glyphicon-log-out"&gt;&lt;/span&gt; Logout&lt;/a&gt;&lt;/li&gt;
        &lt;/ul&gt;
              &lt;/div&gt;
  
          &lt;/div&gt;&lt;!End-Container--&gt;
        &lt;/nav&gt;&lt;!End-Nav-Bar--&gt;
      &lt;div class="jumbotron"&gt;
        &lt;div class="container text-center"&gt;
            &lt;h1&gt;Online Drawing for Electricians&lt;/h1&gt;
            &lt;div class="btn-group"&gt;
                          &lt;a href="" class="btn btn-lg btn-warning "&gt;Search&lt;/a&gt;
                &lt;a href="" class="btn btn-lg btn-default "&gt;Upload&lt;/a&gt;
  
            &lt;/div&gt;
            &lt;/div&gt;
        &lt;/div&gt; &lt;!End Jumbotron--&gt;
      &lt;!Blockquotes--&gt;
        &lt;div class="container"&gt;
        &lt;section&gt;
            &lt;div class= "page-header" id="feedback"&gt;
            &lt;h2&gt;Recent activity of &lt;small&gt;&lt;User&gt;&lt;/small&gt;&lt;/h2&gt;
            &lt;/div&gt;
  
            &lt;div class="row"&gt;
            &lt;div class="col-lg-12"&gt;
                &lt;blockquote&gt;
                &lt;p&gt;"User" Today job is to fix the cables of the central bank.&lt;/p&gt;
                &lt;p&gt;Cables need to be fixed as soon as possible &lt;/p&gt;
                &lt;footer&gt;NK Electrical LTD&lt;/footer&gt;
                &lt;/blockquote&gt;
            &lt;/div&gt;
             &lt;div class="col-lg-12"&gt;
                &lt;blockquote&gt;
                &lt;p&gt;Something Something 
                SomethingSomething
                SomethingSomethingSomething&lt;/p&gt;
                &lt;footer&gt;Aris Con&lt;/footer&gt;
                &lt;/blockquote&gt;
            &lt;/div&gt;
            &lt;/div&gt;
            &lt;/section&gt;
            &lt;a href="planedit.php"&gt;Skip&lt;/a&gt;
                &lt;/div&gt;
  
  
  
  
  &lt;!-- jQuery (necessary for Bootstrap's JavaScript plugins) --&gt;
      &lt;script src="js/jquery-2.1.3.min.js"&gt;&lt;/script&gt;
      &lt;!-- Include all compiled plugins (below), or include individual files as needed --&gt;
      &lt;script src="js/bootstrap.min.js"&gt;&lt;/script&gt;
  
   &lt;/body&gt;                 
  &lt;/html&gt;
  </code></pre>
  
  <p>logout.php</p>
  
  <pre><code>&lt;?php
      session_start();
      if(session_destroy())
      {
          header("location: index.php");
      }
      ?&gt;
  </code></pre>