title: How to print user name after login?
body: <p>I want after somone is logging in to display the user name on another page page , also is this a good way for login ?</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;?php
  
  session_start();
  
  $database =mysqli_connect("localhost", "root", "", "login");
  
  if (isset($_POST['login_bn'])) {
   
   $usrname = mysqli_real_escape_string($db, $_POST['usrname']);
   $pas = mysqli_real_escape_string($db, $_POST['pas']);
   
   $sql = "SELECT * FROM accounts WHERE usrname='$usrname' AND pas='$pas'";
   $result = mysqli_query($database, $sql);
   
   if (mysqli_num_rows($result) == 1) {
    
    header("location: home.php");
   
   } 
   
  ?&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>And i want to display the username here on the nav bar somwhere</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;?php
  
  session_start();
  
  ?&gt;
  
  &lt;!DOCTYPE html&gt;
  
  &lt;html&gt;
  &lt;head&gt;
  
  &lt;/head&gt;
  &lt;body&gt;
  
    &lt;button onclick="'"&gt;Log Out &lt;/button&gt;
  
  &lt;ul&gt;
  &lt;!-- Here somehwere --&gt;
  
  &lt;li&gt;&lt;a href="main.html"&gt; Home&lt;/a&gt;&lt;/li&gt;
  
  
  &lt;/ul&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>sorry for newbie  Question</p>