This is the script for my login php page. It queries my "phplogin" MYSQL Database. When I try to login on a test account, I receive this error:
Notice: Undefined index: username in C:\wamp\www\test\login.php on line 2
Notice: Undefined index: password in C:\wamp\www\test\login.php on line 3
>>>>the code for the login.php page is:
<?php
$username = $_POST['username'];
$password = $_POST['password'];
if ($username&&$password)
{
$connect = mysql_connect("localhost","root","") or die("Couldn't connect to database!");
mysql_select_db ("phplogin") or die ("Couldn't find db");
$query = mysql_query("SELECT * FROM users WHERE username='$username");
$numrows = mysql_num_rows($query);
echo $numrows;
}
else
die("Please enter a username and password");
?>
the form on the login page (userlogin.html) is:
<html>
<form action='login.php' method-'POST'>
Username: <input type='text' name='username'><br>
Password: <input type='password' name='password'><br>
<input type='submit' name='Log in'><br>
</form
</html>
Any ideas whats wrong?
Notice: Undefined index: username in C:\wamp\www\test\login.php on line 2
Notice: Undefined index: password in C:\wamp\www\test\login.php on line 3
>>>>the code for the login.php page is:
<?php
$username = $_POST['username'];
$password = $_POST['password'];
if ($username&&$password)
{
$connect = mysql_connect("localhost","root","") or die("Couldn't connect to database!");
mysql_select_db ("phplogin") or die ("Couldn't find db");
$query = mysql_query("SELECT * FROM users WHERE username='$username");
$numrows = mysql_num_rows($query);
echo $numrows;
}
else
die("Please enter a username and password");
?>
the form on the login page (userlogin.html) is:
<html>
<form action='login.php' method-'POST'>
Username: <input type='text' name='username'><br>
Password: <input type='password' name='password'><br>
<input type='submit' name='Log in'><br>
</form
</html>
Any ideas whats wrong?