The alert message could not show up in PHP after inserting a new record in database

<?php
require_once('connMySql.php');

function function_alert($message) {
  
    // Display the alert box 
    echo "<script type='text/javascript'>alert('$message');</script>";
}

if($_POST){
    $brandName = $_POST["brandName"];
    $brandStatus = '1';
    $brandActive = $_POST["brandStatus"];
    $sql = "INSERT INTO brands(brand_name, brand_active, brand_status) VALUES (?,?,?)";
    $stmt = $db_link->prepare($sql);
    $stmt->bind_param('sss',$brandName,$brandActive,$brandStatus);
    $stmt->execute();
    $stmt->close();
    $db_link->close();

    header("Location: brand.php");
    function_alert('A new record has been inserted');
}

?>

I am expecting the code should show up the alert message after I called the function function_alert when redirecting to the page brand.php but after inserting a new record it just only redirects to the page without showing up the alert message. Any methods could show up the alert message after redirecting to the page?

I tried JavaScript method to show up the alert message but it does not work.