PHP Objects in Forms
I'm using object-oriented PHP for my forms now, because it seems to make sense. Every form field can be customized -- it can render itself to a certain length and type, it can validate itself to specific criteria (date, email, text, etc..), and it can throw its own error message.
What I'm wondering is, when a form is submitted, I just want to have all the $field objects validate themselves and return errors if need be. Is there a way to tell PHP to grab all the $field objects on the page? Or do I have to do something like throw all my field objects into an array and loop through it?
Seems like an unnecessary extra step, but I just want to make sure I'm doing this right.
__________________
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|