Skip to content
Advertisement

echo “windows.open(‘view_users.php’,’_self’)”; – is not working

I’m faily new at this so please help.

I’m doing and admin panel, and once I put my email and password, it doesn’t go to the page I created (view_users.php). I’m following this tutorial. Everything works until minute 15.47. This is a school project, nothing too fancy. Here is the php part of the code:

<?php
error_reporting(E_ALL ^ E_DEPRECATED);
mysql_connect('','','','');
mysql_select_db("");

if(isset($_POST['admin_login'])){

$admin_name = $_POST['admin_name'];
$admin_pass = $_POST['admin_pass'];

$query = "select * FROM admin WHERE admin_name='$admin_name' AND admin_pass='$admin_pass'";

$run = mysql_query($query);
if(mysql_num_rows($run)>0){
echo "<script>windows.open('view_users.php','_self')</script>";

}

else {
    echo "<script>alert('Admin details are incorrect!')</script>";
}
}

?>

oh and yes, I did creat the table with the admin email and pass.

please help. Thank you!

Advertisement

Answer

Change windows to window. tested and works in my localhost


echo "<script>window.open('view_users.php','_self')</script>";

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement