Hi there. I’m trying to build my first user registration form. I have a error message showing up even if I have entered the required info:
Its in 3 parts so far here they are. I appreciate any help as this is my 2 php script
This is my enter user form
[php]
Create a New User Account
This is the submit user form
[php]
Creating Account
body
{
font-family: Arial, Helvetica;
}
.errr_msg
{
color: red;
}
#details_header
{
border-bottom: 1px solid #aaa;
max-width: 400px;
}
require_once(‘Users2.php’);
if (!isset($_POST[‘user_name’]) or trim($_POST[‘user_name’]) == ‘’)
$err = “You must specify a user name”;
else if (!isset($_POST[‘full_name’]) or trim ($_POST[‘full_name’]) == ‘’)
$err = ‘You must specify a full name for your account’;
else if (!isset ($_POST[‘email_address’]) or trim ($_POST[‘email_address’]) == ‘’)
$err = ‘Please provide an email address’;
else if (!isset($_POST[‘password1’]) or trim ($_POST[‘password1’]) != trim($_POST[‘password2’]))
$err = ‘The Passwords provided are either invalid or do not match’;
else
$err = null;
if ($err !==null)
{
echo <<<EOM
<p class='error_msg'>$err</p>
EOM;
}
else
{
$un = $_POST[‘user_name’];
$fn = $_POST[‘full_name’];
$pw1 = $_POST[‘password1’];
$em = $_POST[‘email_address’];
$user = user_create($un, $fn, $pw1, $em);
echo "<h3> Account Created Successfully</h3>\n";
echo "<div id='details_header'>Here are the account details: </div>\n";
user_print($user);
}
?>
<?php ?>[/php]The is the User.php that is required by submit user
[php]<?php
define(‘INVALID_PASSWORD’, ‘ERROR: Invalid Password’);
define(‘USER_ALREADY_LOGGED_IN’, ‘WARNING: User already logged in’);
define(‘USER_NOT_LOGGED_IN’, ‘WARNING : User is not logged in’);
/**
- User have the following feilds:
- ‘Username’
- ‘FulName’
- ‘Password’;
- ‘EmailAddress’
- ‘LoggedIn’ – doesn’t have to be set.
*/
function user_create($username, $fullname, $password, $email_address)
{
return array(‘Username’ => $username, ‘Fullname’ => $fullname,
‘Password’ => md5($password), ‘EmailAddress’ => $email_address);
}
function user_check_password($user, $password_to_check)
{
if (md5($password_to_check) == $user[‘Password’])
return true;
else
return false;
}
function user_update_details(&$user, $dets_to_update)
{
foreach ($dets_to_update as $det => $newvalue)
{
if (isset ($user[$det]) and $newvalue != ‘’)
$user[$det] = $newvalue;
else
return false;
}
return true;
}
function user_login(&$user, $password)
{
if (!user_check_password($user, $password))
return INVALID_PASSWORD;
if (isset($user[LoggedIn]))
return USER_ALREADY_LOGGED_IN;
$user['LoggedIn'] = true;
return true;
}
function user_print($user)
{
foreach ($user as $field => $value)
{
if ($field == ‘Password’)
$value = ‘*********’;
echo "<p><strong>$field</strong>: $value</p>\n";
}
}
function user_logout(&$user)
{
if (!isset($user[‘LoggedIn’]))
return USER_NOT_LOGGED_IN;
unset($user['LoggedIn']);
return true;
}
?>[/php]
I hope someone can help me please 
I have this setup on my local here at http://203.208.98.16/