Login Page - PHP/MySql
Posted: Tue Feb 12, 2008 3:20 pm
I'm a newbie, and trying to learn the basics of MySql and PHP by creating a simple login page. The code below doesn't error out, but doesn't redirect either. Just returns to this page. Any suggestions/information on -why- this is happening would be helpful for the learning process. Thanks in advance.
Code: Select all
if (!empty($_POST['login'])
{
mysql_connect('DB_PATH', 'DB_USER', 'DB_PASSW') or die(mysql_error());
mysql_select_db('DB_NAME') or die(mysql_error());
mysql_query('SELECT * FROM Login WHERE Username = '$_POST['username']' and Password = '$_POST['password']')or die(mysql_error());
header("Location: hello.php");
}
Code: Select all
<form action="" method="POST">
Username: <input type="text" name="username"><br>
Password: <input type="password" name="password"><br>
<input type="submit" name="login" value="login">
</form>
[HTML]