End

Group

AIM

MSN

Website URL

ICQ

Yahoo

Jabber

Skype

Location

Interests

Languages

I'm working of registration form and I have a problem with understanding one of the codes.
<?php // Script 8.9 - register.php
define ('DEFINE', 'register');
include('templates/header.html');
print '<h2>Registration Form</h2>
<p>Register so that you can take advantage of certain features like this, that, and the other things</p>';
print '<style type="text/css" media="screen">
.error { color: red; }
</style>';
if ($_SERVER['REQUESTED_METHOD'] == 'POST') {
$problem = FALSE;
if (empty($_POST['first_name'])) {
$problem = TRUE;
print '<p class="error">Please enter your first name!</p>';
}
if (empty($_POST['last_name'])) {
$problem = TRUE;
print '<p class="error">Please enter your last name!</p>';
}
if (empty($_POST[email'])) {
$problem = TRUE;
print '<p class="error">Please enter your email address.</p>';
}
if (empty($_POST['password1'])) {
$problem = TRUE;
print '<p class="error">Please enter a password.</p>';
}
if ($_POST['password1'] != $_POST['password2']) {
$problem = TRUE;
print '<p class="error">Your password did not match your confirm password.</p>';
}
if (!$problem) {
print '<p>You are now registered.</p>'
}
$_POST = array();
} else {
print '<p class="error">Please try again!</p>
}
}
?>
this part:
if (!$problem) {
print '<p>You are now registered.</p>'
}
Why are we using exclamation mark here? I already defined $problem = FALSE at the beginning of the whole code. That means that there is no problem. If we reverse it to TRUE it will mean that there is a problem with registration but in that case the user shouldn't see "You are now registered". The if condition is fulfilled in any case because with don't have any '<', '>' or '=='.