having trouble redirecting the user based on the $\_GET

this file is called forgot.php

```
<?php 

       $mode_allowed = array('password');
       if (isset($_GET['mode']) === true && in_array($_GET['mode'], $mode_allowed) === true) {
            echo $_GET['mode'];
       } else {
            header('Location: index.php');
            exit();
       }

?>

<form action="" method="post">
    <div class="form-group">
          <label class="sr-only">Email Address</label>
          <input type="text" name="form-emailaddress" placeholder="Email Address" class="form-emailaddress>
          <button type="submit" class="btn signin">Submit</button>
    </div>
</form>

```

So based on the php code, what I believe it should do is that in the URL it should only accept <http://localhost/forgot.php?mode=password> 

however if it's anything else then it should redirect. But what it does is if i change "mode" to something else or mode = "something" which is not in the array ($mode\_allowed) then it just stays at the same page. 

Thanks