Thông báo tên người dùng hoặc mật khẩu sai PHP

Tôi đã viết mã để đăng nhập và nó chuyển hướng đến các trang khác nhau tùy theo vai trò của người dùng nhưng vấn đề là nếu tên người dùng hoặc mật khẩu sai thì nó không hiển thị lỗi mà chỉ hiển thị trang trống. Vui lòng giúp tôi hiển thị thông báo lỗi cho mật khẩu hoặc tên người dùng sai

biểu mẫu đăng nhập. php[mã html]

	<form method="post" action="login.php">
		<label>User Name:</label>
		<input type="text" id="username" name="username" />
		<label>Password:</label>
		<input type="password" id="password" name="password" />
		<label></label><br/>
		<input type="submit" id="login" value="Login" />
		<input type="button" id="cancel_hide" value="Cancel" />

	</form>
 </div>
<div id="shadow" class="popup"></div>

jquery.
[tài liệu]. sẵn sàng[function[e] { [" #shadow "]. fadeIn[“bình thường”];
["#login_form"]. fadeIn["bình thường"]; . tiêu điểm[];["#user_name"].focus[];

$["#cancel_hide"].click[function[]{
    $["#username"].val[]="";
	$["#password"].val[]="";

}];
$[" #tên người dùng "]. thay đổi[hàm[e] {

}];
$[" #login "]. nhấp chuột [hàm[]{

    if[$["#username"].val[].length==0 && $["#password"].val[].length==0]
        {
           // $[this].next[].html["Field needs filling"];
		   $["#username"].after['<span class="errorkeyup">Field cannot be empty</span>'];
		   $["#password"].after['<span class="errorkeyup">Field cannot be empty</span>'];
	        //return false;
            success = false;
        }
		
}]; 

}];

đăng nhập. php

Chủ Đề