用户名或密码错误

为什么总提示用户名或密码错误,我在$username=$_POST["username"];测试输出$username,但是$username为空,密码也和数据库的对不上
=700) window.open('http://bbs.lampbrother.net/attachment/Mon_1109/179_42776_d4ed1f270524911.jpg');" onload="if(this.offsetWidth>'700')this.width='700';if(this.offsetHeight>'700')this.height='700';" > 这题是细说php里面532页的内容
<?php
session_start();
require "connect.inc.php";
if($_GET["action"]=="login"){
$username=$_POST["username"];
$userpwd=md5($_POST["password"]);
$sql='select * from user where username="{$username}" and userpwd="{$userpwd}"';
$result=$mysqli->query($sql);

if($result->num_rows>0){
$row=$result->fetch_assoc();
$_SESSION["username"]=$username;
$_SESSION["userid"]=$row["id"];
$_SESSION["islogin"]=1;
header("Location:index.php");
}else{
echo '<font color="red" >用户名或密码错误!</font>';
}
}
?>

<html>
<head>
<title>邮件系统登录</title>
<style>
input{margin:4px;border:5px solid #aaaaaa;}
</style>
</head>
<body>
<p>欢迎光临邮件系统</p>
<p>Session ID:<?php echo session_id(); ?></p>
<table width='300' border ='0' align="center" cellspacing='0' cellpadding='5'>
<form action='maillogin.php?action=login' method='post'>
<tr>
<td width='30%' align='right' >用户名:</td>
<td><input type='text' naem="username"></td>
</tr>
<tr>
<td width='30%' align='right' >密码:</td>
<td><input type='password' naem="password"></td>
</tr>
<tr>
<td width='30%' align='right' >
<input type ='submit' value='登录'></td>
<td width='30%' align='right' >
<input type='reset' value='重置'></td>
</tr>
</form>
</table>
</body>
</html>

作者: 灯兄弟连   发布时间: 2011-09-15

1.md5后的密码是32位的,看看数据库的设计是否能对上,是不是字段的设计小了,导致存储不全?
2.表单中的,username拼写错误!!没有识别。。。。所以肯定为空。。。

作者: 澎蠡   发布时间: 2011-09-15