Redirection problem from userform.php to statusreport.php upon login

Whenever I log in with a username and password from the database I created my form.php isn’t redirecting to my statusreport.php.

This is my form.php



    if ($_SERVER['REQUEST_METHOD'] == 'POST') {
      // Form submitted, attempt login
      $username = $_POST['username'];
      $password = $_POST['userpassword'];

      // Connect to the database
      $conn = getDatabaseConnection();

      // Prepare the query to fetch user credentials
      $query = "SELECT * FROM users WHERE UserName = :username";
      $stmt = $conn->prepare($query);
  $stmt->bindValue(':username', $username);
  $user = $stmt->fetch(PDO::FETCH_ASSOC);

  if ($user && password_verify($password, $user['UserPassword'])) {
    // Successful login, set session variables
    $_SESSION['UserID'] = $user['ID'];
    $_SESSION['UserName'] = $user['UserName'];
    $_SESSION['FirstName'] = $user['FirstName'];
    $_SESSION['LastName'] = $user['LastName'];
    $_SESSION['UserLevel'] = $user['UserLevel'];

    // Redirect to statusreport.php
    header('Location: statusreport.php');
  } else {
    // Failed login
    $loginError = true;
    echo "<div class="error">Invalid username or password</div>";

<h2>Login Form</h2>
  <?php if (isset($loginError) && $loginError): ?>
    <div class="error">Invalid username or password</div>
  <?php endif; ?>
  <form action="userform.php" method="POST">
    <label for="u`your text`sername">Username:</label>
    <input type="text" name="username" id="username" required><br>

    <label for="userpassword">Password:</label>
    <input type="password" name="userpassword" id="userpassword" required><br>

    <input type="submit" value="Submit">


I have tried making sure the database correction is correct as well as the the table and column variables match what I have inputted in my php code file. Whenever I enter the correct UserName and UserPassword from the table in phpmyadmin and hit submit it redirects me to a blank form.php page and not the statusreport.php?