Im very new to php and this is my first go on on this login. so when im typing in a valid username and password from the database im getting these two errors:
Notice: Undefined index: brukernavn on line 3
Notice: undefined index: passord on line 4
$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!");
?>
Could anyone see where i went wrong here?