Here's what I'm trying to do. If a person types in a valid name and password, it will go to the next page. If the username doesn't exist, then I need it to print an error message. If the username exists but the password doesn't then I need it to print another error message. As of right now I have this.
<?php
//connect to our database
mysql_connect("localhost","root","") or die (mysql_error());
//select our database
mysql_select_db("mapleside") or die (mysql_error());
//get and store our variables from the form
$Customer_UserName = $_POST["Customer_UserName"];
$Customer_Password = $_POST["Customer_Password"];
//grab everything in our database that relates to the user
$queryResult = mysql_query ("SELECT * FROM customer WHERE Customer_UserName = '.$Customer_UserName'");
$queryResult2= mysql_query ("SELECT * FROM customer WHERE Customer_Password = '.$Customer_Password'");
if (!$queryResult)
{
die("Error! Invalid UserName" . mysql_error());
}
//check the password according to our database
if (!$queryResult2)
{
//display error and do nothing else
die("Password is incorrect, please try again");
}
else
{
echo "Logged in sucessfully.<br>";
echo "<a href='http://localhost/login1.htm'>Please click here to continue</a>";
}
<html>
<body>
<form action="login.php" method="post">
Login Name: <input type='text' name='Customer_UserName' maxlength='25' size='15'><br>
Login Password: <input type='password' name='Customer_Password' maxlength='25' size='15'><br>
<input type='submit' name='LoginSubmit' value='Login'>
<input type='reset' name='Reset' value='Reset'>
</form>
</html>
</body>
?>
For starters I'm getting a parse error on my form where it says <html> secondly no matter what name I put in, it says Logged in Successfully. I dont understand. I think my queries are right..........