PHP会话不接受这些值

PHP会话不接受这些值,php,session,Php,Session,每当我填写电子邮件和密码标签,然后按登录按钮时,似乎什么都没有发生,没有加载或提交。但是,我将“电子邮件”和“密码”选项卡留空,然后按“登录”按钮,将显示无效用户名或密码错误 <?php session_start(); if(isset($_POST['submit'])) { include_once("php/config/database.php"); $Email = strip_tags($_POST['Email']); $Password = strip_ta

每当我填写电子邮件和密码标签,然后按登录按钮时,似乎什么都没有发生,没有加载或提交。但是,我将“电子邮件”和“密码”选项卡留空,然后按“登录”按钮,将显示无效用户名或密码错误

<?php

session_start();


 if(isset($_POST['submit'])) {
 include_once("php/config/database.php");
 $Email = strip_tags($_POST['Email']);
 $Password = strip_tags($_POST['Password']);

 $Email = stripslashes($Email);
 $Password = stripslashes($Password);

 $Email = mysqli_real_escape_string($conn, $Email);
 $Password = mysqli_real_escape_string($conn, $Password);

 $Password = md5($Password);

 $sql = "SELECT * FROM Users WHERE Email='$Email' LIMIT 1";
 $query = mysqli_query($conn, $sql);
 $row = mysqli_fetch_array($query);
 $UserID = $row['UserID'];
$conn_Password = $row['Password'];



if($Password == $conn_Password) {
 $_SESSION['Email'] = $Email;
 $_SESSION['UserID'] = $UserID;
 header("Location: account.php");
 } else {
 echo "You didn't enter the correct details!";
 }

 } 


 ?>


 <!DOCTYPE html>

 <html >
 <head>
 <meta charset="UTF-8">
 <title>background</title>

<link rel="stylesheet" href="css/style.css">
 <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>

 <script src="js/index.js"></script>




 </head>

 <body>


 <div class="container demo-1">





 <div class="content">

 <div id="large-header" class="large-header">

 <form action="index.php" method="POST" /> 
 <div class="box">


 <h1 id="logintoregister">Login</h1>


 <div class="group show"> 
 <input class="inputMaterial" type="text" name="FirstName" >
 <span class="highlight"></span>
 <span class="bar"></span>
 <label>First Name</label>
 </div>
 <div class="group show"> 
 <input class="inputMaterial" type="text" name="Surname" >
 <span class="highlight"></span>
 <span class="bar"></span>
 <label>Surname</label>
 </div>


 <div class="group "> 
 <input class="inputMaterial" type="email" name="Email" >
 <span class="highlight"></span>
 <span class="bar"></span>
 <label>Email</label>
 </div>

 <div class="group"> 
 <input class="inputMaterial" type="password" id="password" name="Password" >
 <span class="highlight"></span>
 <span class="bar"></span>
 <label>Password</label>
 </div>
 <div class="group show"> 
 <input class="inputMaterial" type="password" id="confirm_password" >
 <span class="highlight"></span>
 <span class="bar"></span>
 <label>Confirm Password</label>
 </div>


 <button id="buttonlogintoregister" type = "submit" name="submit">Login</button>

 <p id="plogintoregister">By registering, You accept all terms and conditons </p>
 <p id="textchange" onclick="register()"> Sign Up</p>


 </form> 




 <!-- Related demos -->




 <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>

 <script src="js/index.js"></script>



 </body>
 </html>

> JS code

 var cont = 0;

 function register(){

 cont++;

   if(cont==1){
     $('.box').animate({height:'600px'}, 550);
    $('.show').css('display','block');
    $('#logintoregister').text('Register');
    $('#buttonlogintoregister').text('Register');
    $('#plogintoregister').text("Sei gia' registrato?");
    $('#textchange').text('Login');
   }
   else
   {
    $('.show').css('display','none');
    $('.box').animate({height:'365px'}, 550);
    $('#logintoregister').text('Login');
    $('#buttonlogintoregister').text('Login');
    $('#plogintoregister').text("Non sei iscritto?");
    $('#textchange').text('Register');
    cont = 0;
   }
 }

 var password = document.getElementById("password")
 , confirm_password = document.getElementById("confirm_password");

 function validatePassword(){
 if(password.value != confirm_password.value) {
 confirm_password.setCustomValidity("Passwords Don't Match");
 } else {
 confirm_password.setCustomValidity('');
 }
 }

 password.onchange = validatePassword;
 confirm_password.onkeyup = validatePassword;

查阅以下链接,并将其应用于您的代码。同时检查你的控制台。你应该
退出紧跟在
标题之后(“位置:account.php”)