Hi, I have been learning php for a couple months now and have been progressing quite nicely. This morning I attempted to make a log in page, of my own design. Apparently I am doing something wrong. If I log in correctly I am supposed to receive a greeting, otherwise I am told to try again. Instead I get, whether I log in correctly or not I get nothing. Below is a sample code of what I have been working on. If someone could please point me in the right direction I would REALLY appreciate it.
<?php
define('TITLE', 'login');
include ('header.php');
include ('header2.php');
//include ( 'footer.php');
//Format the HTML
print '<div id="leftcontent"><h1>Log in Form</h1>
<p> Users that are logged in can take full advantage of this, that and the other thing!</p>';
//Has the form been submitted?
if(isset($_POST['submit']))
{
//Handle the form
if((!empty($_POST['username']))&&(!empty($_POST['password'])))
{
if(($_POST['username'] == 'test')&&($_POST['password'] == 'password'))
{
print '<p> You are logged in! <br/> Now you can do whatever it was you were going to do!!</p>';
}
else
{
print '<p> The submitted user name and password do not match those on file!!<br/> <b> Go back and try again!</b></p>';
}
}
else
{
print'<p> Please make sure you have entered both the user name and password correctly<br/> Try again!</p>';
}
}
else{
//display the form
print '<form action ="login2.php" method ="post"><p>
Username: <input type ="text" name="username" size="30" /><br/>
Password: <input type="text" name ="passwrd" size ="30" /><br/>
<br/>
<input type="submit" name="submit" value="Log me in!" />
</form>';
}
//complete the HTML
print '<div>';
include ( 'footer.php');
?>