Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

251
Vistas
how to show alert in the redirected page?

in index.php I have 3 buttons (add, delete, edit)

if I click to delete it will redirect to the delete page query (delete.php)

after delete success, the page redirects to index.php and the sweet alert2 will popup with a success message (deleted successfully)

if I add a user the msg will change to added successfully

it depends on where I redirect to index.php

so what I can do?

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

While redirecting from delete.php/edit.php to index.php you can pass some query params.

Redirection from delete.php will look like index.php?msg="deleted successfully";

Redirection from edit.php will look like index.php?msg="added successfully"

In index.php you can read the query string msg and display the alert box

Here is the refs to get query string param.

How can I get query string values in JavaScript?

about 4 years ago · Juan Pablo Isaza Denunciar

0

Solution1

Before redirecting, you should create a session object and save the alert messages in sessions.

start_session()

$_SESSION["alert"] = ["type" => "success", "message" => "User deleted successfully"];

On index.php page

On a index.php page, check if there’s a flash/alert message. If so, output and delete it.

if (isset($_SESSION["alert"]))
{

echo 

"<div class='alert alert-success alert-dismissible'>
                <button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button>
                <h4><i class='icon fa fa-check'></i> Alert!</h4>
                 $_SESSION["alert"]
              </div>";
  
unset($_SESSION["flash"]);
}

Thats it.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda