I'm showing an alert using JS on PHP and I want to refresh the page after certain time and go to the previous page. I tried using this code, but it gives me an error. Is this possible or is there any other way? Any help would really be appreciated! Thanks in advance!
<?php
$message = "New password did not match!";
echo "<script type='text/javascript'>alert('$message');</script>";
header('refresh: .5; url= '$_SERVER['HTTP_REFERER']'');
?>