I want after somone is logging in to display the user name on another page page , also is this a good way for login ?
<?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");
}
?>
And i want to display the username here on the nav bar somwhere
<?php
session_start();
?>
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<button onclick="'">Log Out </button>
<ul>
<!-- Here somehwere -->
<li><a href="main.html"> Home</a></li>
</ul>
sorry for newbie Question