I'm currently working my way through The PHP Anthology: 101 Essential Tips, Tricks & Hacks, 2nd Edition and I have come to an obstacle. I've consulted the corrections for the book and the correction didn't solve the error that I am receiving.
This is the code:
{
// Define the options for formatting the name field
$name_options = array(
'format' => VALIDATE_ALPHA . VALIDATE_SPACE,
'min_length' => 5
);
// Validate name
if (!Validate::string($_POST['name'], $name_options))
{
$errors['name'] = ' class="error"';
}
// Validate email
if (!Validate::email($_POST['email']))
{
$errors['email'] = ' class="error"';
}
// Validate url
if (!Validate::uri($_POST['uri']))
{
$errors['uri'] = ' class="error"';
}
}
and this is the errors that I am receiving:
Notice: Use of undefined constant VALIDATE_ALPHA - assumed 'VALIDATE_ALPHA' in C:\wamp\www\pear_validate.php on line 16
Notice: Use of undefined constant VALIDATE_SPACE - assumed 'VALIDATE_SPACE' in C:\wamp\www\pear_validate.php on line 16
Fatal error: Class 'Validate' not found in C:\wamp\www\pear_validate.php on line 21
Line 16 is red
Line 21 is blue
Can anyone help me diagnose this please?
Thank in advance for your help.
Kris








Bookmarks