How can i do this right? PHP5 Form validation
===

Im trying to set my first steps into the OO PHP world. What im trying to do is make a class that validates my form input. I know what input fields i need in my entire website and want to make a switch, to do the right thing based on the input field. Lets say we have the input field named 'email', and we have a form for that etc..

First what i do is trying to read the $_post names, with array_key() function, based on that i have a switch

Heres my code :

 public function __construct ( $var )
    {
        
         $this->arraykeys = array_keys($var);
         $this->error = false;
         $this->message = array();   
       
    }        

    public function check()
    {   
        
          foreach ($this->arraykeys as $i => $value)
          {
            
          switch ($value)
          {
            case 'email' :
            
            $checkmail = new checkEmail($_POST);
            $checkmail->chkEmail($_POST['email']);
            if ($checkmail->chkEmail($_POST['email']) == false)
            {
                array_push($this->message, 'Cannot validate emailadres');
            }            
            break; 
            
          }
          
            
          }
          
         // print_r($this->field);
    }

The check works, but somehow the message array stays empty after an error!
i tried everything, but i just cant get it into the screen!

Please help! 

Thanks!!