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
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 the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.