i need help over is redirect in php : //hello, please I need help with this php multi-user redirect code. when you 

//log in is able to access the database but I doest redirect the user to its 

//page. please i am new to in PHP?




<?php 
 require 'database-config.php';

 session_start();

 $username = "";

 $password = "";
 
 if(isset($_POST['username'])){

  $username = $_POST['username'];
 }

 if (isset($_POST['password'])) {

  $password = $_POST['password'];

 }
 

 $q = 'SELECT * FROM user_mgnt WHERE username=:username AND password=:password';

 $query = $dbh->prepare($q);

 $query->execute(array(':username' => $username, ':password' => $password));


 if($query->rowCount() == 0){

  header('Location: index.php?err=1');

 }else{

  $row = $query->fetch(PDO::FETCH_ASSOC);

  session_regenerate_id();

  $_SESSION['sess_user_id'] = $row['id'];

  $_SESSION['sess_username'] = $row['username'];

  $_SESSION['sess_userrole'] = $row['role'];

      	 echo $_SESSION['sess_username'];

       	 echo $_SESSION['sess_userrole'];

  		 session_write_close();

  if( $_SESSION['sess_userrole'] == "Admin"){

   header('Location: Dashboard.php');

  }
  
  elseif ( $_SESSION['sess_userrole'] == "Employee"){

   header('Location: emp_dashboard.php');

  }
  
  elseif ( $_SESSION['sess_userrole'] == "Registrar"){

   header('Location: Registration_Dashboard.php');

  }
  
  elseif ( $_SESSION['sess_userrole'] == "Accountant"){

   header('Location: Account_Dashboard.php');

  }
  
   else{

   header('Location: emp_dashboard.php');

  }
  
 
  
 }


?>