Site Owners Forums - Webmaster Forums

Site Owners Forums - Webmaster Forums (http://siteownersforums.com/index.php)
-   PHP / mySQL (http://siteownersforums.com/forumdisplay.php?f=10)
-   -   PHP Objects in Forms (http://siteownersforums.com/showthread.php?t=51978)

ncjbhd 10-24-2011 12:33 AM

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.


All times are GMT -7. The time now is 07:29 AM.


Powered by vBulletin Copyright © 2020 vBulletin Solutions, Inc.