Success message after password exchange

Asked

Viewed 40 times

0

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

Follow 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'] ;?>
  • 1

    Are you starting Session on the Dashboard.php side and on that file with the Location header ? If yes, this is ok, if not, start Session on both parts, then change the header: 'Location: htttp:/your domain/Dashboard.php', comment on whether to resolve or not

  • It was the full link! Thank you

1 answer

1

Inform a location in the header needs you to enter the whole address of directing, example:

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();

Browser other questions tagged

You are not signed in. Login or sign up in order to post.