the header is being ignored

header, php

Solution

Script execution continues after setting a `Location:` header (or any other call to `header()`, for that matter). If you want the redirect to happen immediately, without the rest of the script executing, `return;` or `die;` immediately after you call `header()`.

Problem

``` <? session_start(); $id = $_SESSION['id']; $email = $_COOKIE['email']; $password = $_COOKIE['password']; header('Location: ../'); // I tell it to redirect... $cookie_expires = time() + 60*60*24; $cookie_path = '/'; $cookie_name = 'temporary'; $cookie_value = 'Your account was deleted.'; setcookie($cookie_name, $cookie_value, $cookie_expires, $cookie_path); // ...but the cookie is set! ?> <!-- Why? --> ```

Original source