PHP-登录帐户工作

its my first time creating a login page. I want users to login, then the page redirects to the customer account page, if they have a account. I have added echo's so i can see whats happening. I have a "Logged in successfully" alert that works perfectly when i login. The page just does not redirect.

HTML

 <section class="container">
        <form id="myform " class="Form" method="post" action="login.php" accept-charset="utf-8">

            <!--                    <div id="first">-->
            <input type="email" id="email" name="email" placeholder="Email Address" value='' required>  
            <input class ="login-field" type="password" id="pass1" name="pass1" value="" placeholder="Password"  maxlength="30" required>
            <input type="submit" name="login" value="login"  class="btn ">
            <br>
        </form>

PHP

 <?php
 session_start();
 require ('./mysql.inc.php');
 ?>

 <?php
        if (isset($_POST['login']))

        //database varianbles
        $c_email = $_POST['email'];
        $c_password = $_POST['pass1'];

        // select login details
        $sel_c = "SELECT * FROM Cus_Register WHERE Cus_Email='$c_email' AND     Cus_Password='$c_password'";

        $run_c = mysqli_query($dbc, $sel_c);
        //check if customer is on databse
        $check_customer = mysqli_num_rows($run_c);


        if ($check_customer == 0) {
            echo "<script> alert('password or email is incorrect please try again')</script>";
         exit(); 
         }
           else{
            $_SESSION['Cus_Email'] = $c_email;
            echo "<script> alert ('Logged in successfully')</script>";
            echo "<script>window.open('./customer/Cus_Account.php'.'_self')          </script>";
        }
    ?>

Do you intend window.open('./customer/Cus_Account.php'.'_self') to be window.open('./customer/Cus_Account.php', '_self')?

window.open takes a location and a target parameter and in JavaScript parameters are separated by a comma, not a full stop. In this case './customer/Cus_Account.php' is the location and '_self' is the target.

You may use header() to redirect

else
{
   $_SESSION['Cus_Email'] = $c_email;
   header('Location: customer/Cus_Account.php');
   exit();
}

hope it helps:)