Here is the complete code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Registration Results</title>
<style type="text/css" media="screen">
.error {color: red;}
</style>
</head>
<body>
<h2>Registration Results</h2>
<?php // Script 6.2 - handle_reg.php
/* this script handles 8 values from register.html:
email, password, confirm, month, day, year, color, submit */
// Flag Variable to track success
$okay = TRUE
// Validate the email address
if (empty($_POST['email'])) {
print '<p class="error">Please enter your email address.</p>';
$okay = FALSE;
}
// Validate the password
if (empty($_POST['password'])) {
print '<p class="error">Please enter your password.</p>';
$okay = FALSE;
}
// If there are no errors, print a success message
if ($okay) {
print '<p>You have successfully registered.</p>';
}
?>
</body>
</html>
The error message is: Parse error: syntax error, unexpected ‘if’ (T_IF) in C:\wamp\www\php\handle_reg.php on line 29
and line 29 is if (empty($_POST[‘email’])) {
Thanks so much for your input on this. I’m trying to truck through this book and this exercise has been quite an obstacle for some reason.
Bill