1.	<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2.		"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3.	<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4.	<head>
5.		<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
6.		<title>Registration</title>
7.		<style type="text/css" media="screen">
8.			.error { color: red; }
9.		</style>
10.	</head>
11.	<body>
12.	<h2>Registration Results</h2>
13.	<?php // Script 6.4 - handle_reg.php #3
14.	/* This script receives eight values from register.html:
15.	email, password, confirm, month, day, year, color, submit */
16.	
17.	// Address error management, if you want.
18.	
19.	// Flag variable to track success:
20.	$okay = TRUE;
21.	
22.	// Validate the email address:
23.	if (empty($_POST['email'])) {
24.		print '<p class="error">Please enter your email address.</p>';
25.		$okay = FALSE;
26.	}
27.	
28.	// Validate the password:
29.	if (empty($_POST['password'])) {
30.		print '<p class="error">Please enter your password.</p>';
31.		$okay = FALSE;
32.	}
33.	
34.	// Validate the birthday:
35.	$birthday = '';
36.	
37.	// Validate the month:
38.	if (is_numeric($_POST['month'])) {
39.		$birthday = $_POST['month'] . '-';
40.	} else {
41.		print '<p class="error">Please select the month you were born.</p>';
42.		$okay = FALSE;
43.	}
44.	
45.	// Validate the day:
46.	if (is_numeric($_POST['day'])) {
47.		$birthday .= $_POST['day'] . '-';
48.	} else {
49.		print '<p class="error">Please select the day you were born.</p>';
50.		$okay = FALSE;
51.	}
52.	
53.	// Validate the year:
54.	if (is_numeric($_POST['year'])) {
55.		$birthday .= $_POST['year'];
56.	} else {
57.		print '<p class="error">Please enter the year you were born as four digits.</p>';
58.		$okay = FALSE;
59.	}
60.	
61.	// If there were no errors, print a success message:
62.	if ($okay) {
63.		print '<p>You have been successfully registered (but not really).</p>';
64.		print "<p>You entered your birthday as $birthday.</p>";
65.	}
66.	?>
67.	</body>
68.	</html>