PHP不响应表单提交


php not responding to form submission

当我提交表单时,页面会重新加载。即使我更改了PHP文件,结果也是一样的。没有输出告诉我代码运行的状态。我共享的PHP文件是login.php

<?php
    include 'connect.php';
    if(isset($_POST['submit']))
    {
        $n=$_POST['name'];
        $p=$_POST['pass'];
        $q="SELECT NAME FROM user
            WHERE name='$n' and password='$p';";
        $res=$conn->query($q);
        echo "k";
        echo "<script>window.alert('here')</script>";
        if($res->num_rows == 1)
        {
            session_start();
            $_SESSION['name']=$n;
            $_SESSION['pass']=$p;
            echo "<a href='cust.php'>";
        }
        else
        {
            echo "<script>document.getElementById('resp').innerHTML='<i>please enter valid name and password</i><br></script>'";
        }
    }
?>
<html>
<head>
    <title>title</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="description" content="" />
    <meta name="keywords" content="" />
    <meta name="robots" content="index,follow" />
    <!--<link rel="stylesheet" type="text/css" href="styles.css" />-->
</head>
<body>
    <form method="post" action="login.php" enctype="application/x-www-form-urlencoded">
        <!--<b>First Day of stay</b><input type="date" name="start"><br><br>
        <b>Last Day of stay</b><input type="date" name="start"><br><br>-->
        <input type="text" id="name" placeholder="Your name"><br><br>
        <input type="password" id="pass" placeholder="password"><br><br>
        <input type="submit" text="login">
        <span id="resp">
        </span>
    </form>
</body>
</html>

稍微更正一下:

 <input type="text" id="name" name="name" placeholder="Your name"><br><br>
 <input type="password" id="pass" name="pass" placeholder="password"><br><br>
 <input type="submit" name="submit" text="login">