SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member
    Join Date
    Oct 2009
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Pear_validate.php class fatal error help

    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

  2. #2
    Non-Member
    Join Date
    Oct 2009
    Posts
    1,852
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Class 'Validate' not found

  3. #3
    SitePoint Member
    Join Date
    Oct 2009
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Shrapnel_N5 View Post
    Class 'Validate' not found
    So I guess the book doesn't supply the necessary code if you are following along in practical application...

  4. #4
    SitePoint Member
    Join Date
    Oct 2009
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question

    Also, I don't see any documentation for setup of pear on wamp. Can anyone point us wamp users in the right direction?

  5. #5
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,716
    Mentioned
    103 Post(s)
    Tagged
    4 Thread(s)
    Result #1 from googling pear wamp

    Installing PEAR on WAMP
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •