October 2002
Intermediate to advanced
368 pages
7h 12m
English
You can soup up this script to be smarter:
This script as it currently is can be easily fooled if a user just enters spaces in each of the fields. In the check_form script on lines 46 and 50, we check to see if the user entered anything. This includes spaces. If we want to make sure the users enter characters (not just spaces), we could check like this:
if(ereg("^ +", $last)) {
$error[last] = true;
$print_again = true;
}
Basically, the ereg() function is checking the $last variable to see if it starts with one or more spaces. We'll take a closer look at the ereg() function a little later in this chapter.
Sometimes you may want to make sure the user enters a minimum ...
Read now
Unlock full access