I have 3 pages, I am trying to create a simple member login system using session .
In my first page ( index.php) I have database connection, session setup and this following login from :
<form action="index.php" method="POST">
  <table>
    <tr>
        <td><label>Username</label></td>
        <td><input type="text" name="username" /></td>
    </tr>
    <tr>
        <td><label>Password</label></td>
        <td><input type="password" name="password" /></td>
    </tr>
    <tr>
        <td></td>
        <td><input type="submit" name="submitbtn" value="Login" /></td>
    </tr>
  </table>
</form>
In member's profile page (member.php), I have a table to fetch data from database of that specific member logged in :
<table>
  <?php $members=getMember(); ?>
  <?php  while($member = $members->fetch_assoc()) : ?>
  <tr><td><label>Name</label></td><td><?php echo $member['name'];?></td></tr>
  <tr><td><label>Age</label></td><td><?php echo $member['age'];?></td></tr>
  <?php endwhile; ?>
</table> 
and at dbconnection.php page I have this function :
<?php
function getMember(){
  $db_conn = getConnection();
  $username = isset($_POST['username']) ? $_POST['username'] : '';
  $password = isset($_POST['password']) ? $_POST['password'] : '';  
  if(!$db_conn) return false;
  $sql = "SELECT * FROM member WHERE username ='$username' AND password='$password'";
  $result = $db_conn->query($sql);
  $db_conn->close();
  return $result;
}
The code of session setup are :
<?php 
$username="";
$password="";
$success=true;
$_SESSION['username']=$username;
if(isset($_POST['username']) && isset($_POST['password']))
{
    $username=$_POST['username'];
    $password=$_POST['password'];       
    if(check_in_db($username,$password)){
        $_SESSION['logged_in']=1;
        $_SESSION['username']=$username;
        header("Location: adminPanel.php");
    }
    else{
        $success=false;
    }
}   
?>
But when I am logging in, data ( name and age ) is not fetching ( displaying) there in member.php page ( I can't add image, since my reputation is under 10 ).
Thank you for your time .
 
    