Darth Vader Darth Vader - 6 months ago 31
PHP Question

PHP error- Header sleep function not working

I have a

PHP
code that has
header
and
sleep
to display an alert. But the
sleep
does not seem to be working.

Please Check the code:

<?php

if ($query) {
echo '<script language="javascript">';
echo 'alert("Registration SUCCESFUL")';
echo '</script>';
header('sleep(10);');
header('Location: http://localhost/amberTAG%20requester/Login%20Page/Login.html');
} else {
echo '<script language="javascript">';
echo 'alert("Registration UNSUCCESFUL, Sorry!")';
echo '</script>';
header('sleep(10);');
}
?>


Thanks,

Answer

Just use sleep without header

sleep(10);
header('Location: http://localhost/amberTAG%20requester/Login%20Page/Login.html');

Or use:

header('refresh:10; URL=http://localhost/amberTAG%20requester/Login%20Page/Login.html');