Sorry, if it is obvious for you. I'm new in JavaScript.
I have written a script within a PHP and the page wants user a password to open a new window.
If the password is wrong or if it is null, it will give a specific error inside the current page by going to another url. but if the condition is satisfied, it will open a new page.
The problem is that I don't know how to close the former page automatically.
Here is my code:
<?php
$var1="1";
$pass=$_POST['password'];
if ($pass==$var1)
{ ?>
<script>
window.open('1.html');
</script>
<?php
}
elseif ($pass=="")
{header("location:null.html");}
else {header("location:error.html");}
?>
Thank you