Redirect to another page with a message

Viewed 50635

I want to redirect to a page and then display a message:

What I have is:

//succes            
$message = 'succes';
redirect_to('index.php');

On the index page I have:

if (!empty($message)) {
    echo '<p class="message"> '.$message.'</p>';
}

The redirect function is working fine:

function redirect_to( $location = NULL ) {
    if ($location != NULL) {
        header("Location: {$location}");
        exit;
    }
}

But it won't display my message. It's empty.

6 Answers
Related