K
K
Konstantin Teploukhov2020-04-21 21:52:13
PHP
Konstantin Teploukhov, 2020-04-21 21:52:13

How to display alert and redirect?

How to make first echo in which js code (in my case, alert with information about incorrect login or passwords) and then redirect to the authorization page (login.php)
Tried like this but an error

cry

if($login == $adminLogin AND $pass == $adminPass)
{
  $_SESSION['admin'] = true;
  header("Location: index.php");
  exit;
}
else
{
  echo '<script>alert("Логин и/или пароль неверны!");</script>';
  header("Location: login.php");
  exit;
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
DevMan, 2020-04-21
@blood-moon

make a redirect with js'om after the alert.
PHP generally rests here.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question