Email verification

From: Cesar Aracena (lists_at_icaam.com.ar)
Date: 12/31/03


To: php-general@lists.php.net
Date: Wed, 31 Dec 2003 15:18:32 -0300

Hi all,

I'm trying to create a script to check for errors in submitted forms. I want
the visitor to enter two times the email address and then check for it...
This is what I have so far. The scripts checks if the email was entered in
both fields, but not if they are equal to each other... ???

if (!trim($email1))
     {
      echo "<BR>El <B>E-mail</B> es requerido.";
      $errors++;
      if (!trim($email2))
      {
       echo "<BR>El <B>E-mail</B> es requerido en ambos campos.";
       $errors++;
       if ($email1 != $email2)
       {
        echo "<BR>Las <B>direcciones de E-mail</B> no concuerdan.";
        $errors++;
       }
      }
     }

What is wrong? Thanks in advanced and happy new year to all.

Cesar Aracena