Hi, I am creating a log in page so I can learn more about the programming. It's a very, very simple one containing just a username, password1 and password2. Once I can make this work I will understand enough to go to the next step (I think). I have made and re-made this several times and have decided I need to have some help before I get a concussion from banging my head into this wall. When I submit the simple form I keep getting the error "enter a user name and password" There are only 3 text fields in the form right now, they are filled. Thank you so much in advance for your help.
<html><head><title>List Directory!</title></head><body>
<?php
//Address errors
ini_set('display_errors', 1);
error_reporting(E_ALL & ~E_NOTICE);
//This script allows users to register and store the log in info in a txt file
if(isset($_POST['submit']))
//Handle form
{
$problem = FALSE;
//Check for values
if(empty($_POST['username']))
{
$problem = TRUE;
print 'Please enter a user name';
}
if(empty($_POST['password1']))
{
$problem = TRUE;
print 'Please enter a password';
}
if (empty($_POST['password2']))
{
$problem = TRUE;
print 'Please confirm your password';
}
if(!$problem)
{
if($fp = fopen('..users//users.txt', 'ab'))
{
//create data to be written
fwrite($fp, $data);
fclose($fp);
//create directory
mkdir("..//users//$dir");
//print message
print 'You are now registered!';
}
else
{
//forgot a field
print 'Please make sure all fields are filled in';
}
}
}
else
{
//display the form
?>
<form action = "reguser2.php" method="post">
Username: <input type ="text" name ="username" size ="20" /><br/><br/>
Password: <input type ="password" name ="password1" size="20" /><br/><br/>
Confirm password: <input type="password" name="password2 size=20" /><br/><br/>
<input type="submit" name="submit" value="REGISTER ME!!" />
</form>
<?php
}
?>
</body></html>