无法使用php登录

无法使用php登录,php,login,Php,Login,虽然相同的概念正在其他表单上运行登录功能,但我无法做到这一点。帮助我登录和注册。无法执行此操作。这是登录和注册表单的代码和hlater login.php页面,用于登录和注册数据库。所有细节都在代码中。并请报告错误,需要进一步修改。提前感谢: <!DOCTYPE html> <!--[if lt IE 7 ]> <html lang="en" class="no-js ie6 lt8"> <![endif]--> <!--[if IE 7 ]

虽然相同的概念正在其他表单上运行登录功能,但我无法做到这一点。帮助我登录和注册。无法执行此操作。这是登录和注册表单的代码和hlater login.php页面,用于登录和注册数据库。所有细节都在代码中。并请报告错误,需要进一步修改。提前感谢:

<!DOCTYPE html>
<!--[if lt IE 7 ]> <html lang="en" class="no-js ie6 lt8"> <![endif]-->
<!--[if IE 7 ]>    <html lang="en" class="no-js ie7 lt8"> <![endif]-->
<!--[if IE 8 ]>    <html lang="en" class="no-js ie8 lt8"> <![endif]-->
<!--[if IE 9 ]>    <html lang="en" class="no-js ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html lang="en" class="no-js"> <!--<![endif]-->
    <head>
        <meta charset="UTF-8" />
        <!-- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">  -->
        <title>Login and Registration Form T & P Cell</title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0"> 
        <meta name="description" content="Login and Registration Form with HTML5 and CSS3" />
        <meta name="keywords" content="html5, css3, form, switch, animation, :target, pseudo-class" />
        <meta name="author" content="Codrops" />
        <link rel="shortcut icon" href="../favicon.ico"> 
        <link rel="stylesheet" type="text/css" href="css/demo.css" />
        <link rel="stylesheet" type="text/css" href="css/style.css" />
        <link rel="stylesheet" type="text/css" href="css/animate-custom.css" />
    </head>
    <body>
        <div class="container">
            <!-- Codrops top bar -->
            <div class="codrops-top">

                <span class="right">

                </span>

            </div><!--/ Codrops top bar -->

            <section style=" height: 480px">                
                <div id="container_demo" >

                    <a class="hiddenanchor" id="toregister"></a>
                    <a class="hiddenanchor" id="tologin"></a>
                    <div id="wrapper">
                        <div id="login" class="animate form" style=" height: 270px">
                            <form  action="login.php" method="POST" autocomplete="on"> 
                                <h1>Log in</h1> 
                                <p> 
                                    <label for="username" class="uname" data-icon="u" > Your email or username </label>
                                    <input id="username" name="username" required="required" type="text" />
                                </p>
                                <p> 
                                    <label for="password" class="youpasswd" data-icon="p"> Your password </label>
                                    <input id="password" name="password" required="required" type="password" /> 
                                </p>
                                <p class="keeplogin"> 
                                    <input type="checkbox" name="loginkeeping" id="loginkeeping" value="loginkeeping" /> 
                                    <label for="loginkeeping">Keep me logged in</label>
                                </p>
                                                             <p class="login button" style="float: left">

                        Not a member?           <a href="#toregister" class="to_register"  > Join Us                                                                                                     </a>
                                </p>
                                <p class="login button"> 
                                    <input type="submit" value="Login" /> 
                                </p>

                            </form>
                        </div>

                        <div id="register" class="animate form"  style=" height: 400px">
                            <form  action="mysuperscript.php" autocomplete="on"> 
                                <h1> Sign up </h1> 
                                <p> 
                                    <label for="usernamesignup" class="uname" data-icon="u"> Full name</label>
                                    <input id="usernamesignup" name="usernamesignup" required="required" type="text"  />
                                </p>
                                <p> 
                                    <label for="emailsignup" class="youmail" data-icon="e" > Your email</label>
                                    <input id="emailsignup" name="emailsignup" required="required" type="email" /> 
                                </p>
                                 <p> 
                                    <label for="passwordsignup" class="youpasswd" data-icon="p">Your password </label>
                                    <input id="passwordsignup" name="passwordsignup" required="required" type="password" />
                                </p>



                                <p> 
                                    <label for="passwordsignup_confirm" class="youpasswd" data-icon="p">Please confirm your password </label>
                                    <input id="passwordsignup_confirm" name="passwordsignup_confirm" required="required" type="password"/>
                                </p>

                                <p class="login button" style="float: left">
                                Already a member ?
                                    <a href="#tologin" class="to_register"> Go and log in </a>
                                </p>
                                <p class="signin button"> 
                                    <input type="submit" value="Sign up"/> 
                                </p>

                            </form>
                        </div>

                    </div>
                </div>  
            </section>
        </div>
    </body>
</html>




        <?php
    session_start(); // Starting Session
    $error = ''; // Variable To Store Error Message
    if (isset($_POST['submit'])) {
        echo "string6";
        if (empty($_POST['username']) || empty($_POST['password'])) {
            echo "gh";
            $error = "Username or Password is invalid";
        } else {
            echo "asdfgh";
            // Define $username and $password
            $username   = $_POST['username'];
            $password   = $_POST['password'];
            // Establishing Connection with Server by passing server_name, user_id and password as a parameter
            $connection = mysqli_connect("localhost", "root", "");
            // To protect MySQL injection for Security purpose
            $username   = stripslashes($username);
            $password   = stripslashes($password);
            $username   = mysqli_real_escape_string($username);
            $password   = mysqli_real_escape_string($password);
            // Selecting Database
            $db         = mysqli_select_db("tandp_db", $connection);
            // SQL query to fetch information of registerd users and finds user match.
            $query      = mysqli_query("select * from login where password='$password' AND username='$username'", $connection);
            $rows       = mysqli_num_rows($query);
            if ($rows == 1) {
                $_SESSION['login_user'] = $username; // Initializing Session
                header("location:login.html"); // Redirecting To Other Page
            } else {
                $error = "Username or Password is invalid";
            }
            mysqli_close($connection); // Closing Connection
        }
    }
    ?>

在脚本下面的php代码中,您正在检查以下内容:如果isset$\u POST['submit'],那么在登录表单中,请指定要提交的名称按钮:

可能已经发送了标题?实际上。。php代码不工作。。。表示无法执行任何php操作