php redirect multiple users to multiple pages after login
<p>I have created a login with multiple users. i have connected phpMyAdmin database and single user login is working properly. with login.php code it is not redirected to the intended page.dbconnect.php is working. </p>

<p><strong>login.php</strong></p>

<pre><code>&lt;?php

require('dbconnect.php');

 if(isset($_POST['uname']) &amp;&amp; isset($_POST['pw'])){

    $email=$_POST['uname'];
    $pw=$_POST['pw'];

if ($stmt = mysql_query("SELECT role FROM register WHERE 'email'= ? and 'pw'= ? ")) {
    /* bind parameters for username and password */
    $stmt-&gt;bind_param('ss', $email, $pw);


    /* execute query */
    $stmt-&gt;execute();

    // If result matched $myusername and $mypassword, table row must be 1 row
    if ($stmt-&gt;affected_rows == 1) {
        // bind the result to a variable
        $stmt-&gt;bind_result($role);
        $stmt-&gt;fetch();


        switch( $role ){

            case 'admin':
                header("location:admin.php");
                exit();

            case 'trackcoordinator':
                header("location:trackco.php");
                exit();

            case 'reviewer':
                header("location:reviewer.php");
                exit();

            case 'author':
                header("location:sub.php");
                exit();

            default:
                echo "Wrong Username or Password";
        }

    }

    $stmt-&gt;close();
}
}

//$db-&gt;close();

?&gt;
</code></pre>

<p>This is the register table. And data is fetching from this one for login process: </p>

<p><a href="https://i.stack.imgur.com/auvYq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/auvYq.png" alt="enter image description here"></a></p>