I already tried the 2 re-directions in JavaScript, the window.location.href()
and header()
but always show me an error:
ReferenceError: header is not defined
My code from PHP:
echo "<script> header('location: index.php');</script>";
I already tried the 2 re-directions in JavaScript, the window.location.href()
and header()
but always show me an error:
ReferenceError: header is not defined
My code from PHP:
echo "<script> header('location: index.php');</script>";
There's no header()
function in JavaScript. header()
is a PHP function. Here is one way to redirect using JS:
echo "<script> window.location.href = 'index.php'; </script>";
Or in PHP:
header('Location: index.php');
exit;