How do I echo a user's name and his specific country? Like this:
Account name: leo
Country: Germany
The account name is working.
PHP at the top of the page is:
<?php
session_start();
if (!isset($_SESSION['username'])) {
$_SESSION['msg'] = "You must log in first";
header('location: login.php');
}
if (isset($_GET['logout'])) {
session_destroy();
unset($_SESSION['username']);
header("location: login.php");
}
?>
Connect to database (seperate file server.php):
$db = mysqli_connect('localhost', 'root', '', 'registration');
HTML:
<li class="p-li">Account name: <?php echo $_SESSION['username']; ?></li>
<li class="p-li">Country:<?php echo $_a['a']; ?> </li>