Registration

The registration script was first started in Chapter 7, “Using PHP with MySQL.” It has since been improved upon in many ways. This version of register.php will do the following:

  • Both display and handle the form
  • Validate the submitted data using regular expressions
  • Redisplay the form with the values remembered if a problem occurs (the form will be sticky)
  • Process the submitted data using the escape_data() function from the mysql_connect.php script
  • Ensure a unique email address
  • Send an email containing an activation link

To write register.php

1.
Create a new document in your text editor (Script 13.6).
<?php # Script 13.6 - register.php
Script 13.6. The registration script uses regular expressions for security and a sticky form ...

Get PHP and MySQL for Dynamic Web Sites: Visual Quickpro Guide, Second Edition now with O’Reilly online learning.

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