Putting It All Together

Now that we have the building blocks to build smart, friendly, and easy form processing, let's take a look at a real-world example. This example, shown in Figure 4-1, provides a way for a user to register for a typical community site.

Figure 4-1. register.php

Some of the fields are required and some are not. The script deems fields to be required if the field name ends with “_required”.

The script also checks to make sure that a valid email address is entered and that the user enters two identical passwords.

Script 4-4. register.php
					1. <html>
  2. <head>
  3.   <title>Register</title>
  4. <style type="text/css">
  5. .error {color:red; ...

Get Advanced PHP for Web Professionals now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.