没有继续脚本php的重定向页面

I have to check information from a form and if it is false I want my user redirected without the script continuing. It works with header:location but the script continues to execute.

An example:

        foreach ($array as &$value) {
        if (empty($value)){
                header("location:garagecreation.php");

                }
    }
 ..... code code 

If my $value is empty I want the script to stop and redirect.

Thanks for the time spent reading this.

You need to use exit with header, like this

header("location: garagecreation.php");
exit;

You have to use :

header("location:garagecreation.php"); die();