I have a page that requests a password from user, and if the condition statement is satisfied, I want the current page to be closed, and a new window be opened instead of the former page.
I had no problem with my code in my PC's localhost and it was working without any problem. But when I upload the page into my server, there is a bad problem.
It closes the current page as I want, but it doesn't open the new window.
Here is my code:
<?php
$var1="701016";
$pass=$_POST['password'];
if ($pass==$var1)
{ ?>
<script>
window.close();
window.open("hb.html","","height=800, width=1000, left=150");
</script>
<?php
ob_start();
}
elseif ($pass=="")
{header("location:empty.html");}
else {header("location:error.html");}
?>
Problem is with lines 7, 8
For opening window new I tried this too, but it was not effective.
window.close();
myWindow = window.open("hb.html","mywindow","height=800, width=1000,left=150");
I've got so confused. Thank you.