谁能解释我如何在同一页面中检查和注册用户名和密码?
如何在表单中回显“错误的用户名和密码”消息?
提前致谢。
检查登录
$result=mysql_query($sql);
$count=mysql_num_rows($result);
// If result matched $myusername and $mypassword, table row must be 1 row
if($count==1){
// Register $myusername, $mypassword and redirect to file "login_success.php"
session_register("myusername");
session_register("mypassword");
header("location:login_success.php");
}
else {
echo "Wrong Username or Password";
形式
<form class="clearfix" name="form1" method="POST" action="">