我对 php 很陌生,这是我第一次登录。所以当我从数据库中输入一个有效的用户名和密码时,我得到了这两个错误:
注意:未定义的索引:第 3 行的 brukernavn
注意:未定义的索引:第 4 行的 passord
$username = $_POST['brukernavn'];
$password = $_POST['passord'];
if($username&&$password)
{
$connect = mysql_connect("localhost", "root", "") or die ("Cannot connect");
mysql_select_db("prosjekt") or die ("Cant find db");
$query = mysql_query("SELECT * FROM bruker WHERE brukernavn='$username'");
$radnum = mysql_num_rows($query);
if ($radnum!=0)
{
while ($rad = mysql_fetch_assoc($query))
{
$dbuser = $rad['brukernavn'];
$dbpass = $rad['passord'];
}
if ($username==$dbuser&&$password==$dbpass)
{
echo "Logged in";
}
else
echo "Wrong username or password";
}
else
die("That user does not exist!");
}
else
die("Please enter a username and password!");
?>
谁能看到我在这里出错的地方?