[thelist] OOP Validation Classes in PHP

RUST Randal RRust at COVANSYS.com
Mon Sep 22 08:08:48 CDT 2003


Over the weekend, I began working on PHP classes to do form validation.
Since this is a new concept to me, I'm not sure if I'm on the right
track. 

I have the following classes:

ValidateAddress
ValidateContactMethods
ValidatePerson

I run these three classes to validate the data that has been input by
the user. If there are errors, then I don't want the data submitted to
the database, I want the errors displayed. To check for errors, each
class returns "true" or "false" on an error variable. This is checked by
the following class:

ErrorCheck

If there are no errors, then the following classes are run:

InsertAddress
InsertContactMethods
InsertPerson

I'm still approaching it from a very procedural manner, but the idea of
using the classes is something that seems to make sense, as long as I
can write them in a way that allows them to be reusable from project to
project (of course, that's the whole point).

I can't seem to find a lot of resources for OOP in PHP. A lot of the
stuff deals with creating things like calendars, and not validation
processes, which is what 95% of my projects require, so I'm kind of
guessing at a lot of this right now.

Any pointers would be greatly appreciated.

----------
Randal Rust
Covansys Corp.
Columbus, OH 


More information about the thelist mailing list