Success message after password change

0

I want to display a success message after the user switches password, with bootstrap and PHP.

Here's what I'm trying to do:

if($login == null){
    header("Location: index.php");
} else {
    $_SESSION["email"] = $email;
    header("Location: dashboard.php");
    $_SESSION['mensagem'] = '<div class="alert alert-success" role="alert">Senha alterada com sucesso!</div>';
}
die();

And calling the variable on the page where the message should appear:

<?php echo $_SESSION['mensagem'] ;?>
    
asked by anonymous 24.05.2018 / 22:37

1 answer

1

Entering a location into header requires you to enter the entire address of the address, eg:

if($login == null){
    header("Location: index.php");
} else {
    $_SESSION["email"] = $email;
    header("Location: http://seudominio/dashboard.php");
    $_SESSION['mensagem'] = '<div class="alert alert-success" role="alert">Senha alterada com sucesso!</div>';
}
die();
    
25.05.2018 / 00:40