chaiwei Posted July 23, 2009 Share Posted July 23, 2009 Hi, May I know how you all do validation for a for a form. Normally we use ctype,filter,preg_match, check_date, is_string, is_? But if I got a form having 100 of field, It is impossible for me to go and validate all the field whether it is a valid date, email, string. is there any way to improve the form validation? btw, ctype and filter which one is better? Quote Link to comment Share on other sites More sharing options...
dzelenika Posted July 23, 2009 Share Posted July 23, 2009 Try to find out some way to iterate your fields with for or foreach loop Quote Link to comment Share on other sites More sharing options...
chaiwei Posted July 23, 2009 Author Share Posted July 23, 2009 u mean like using class and form API? Quote Link to comment Share on other sites More sharing options...
RichardRotterdam Posted July 23, 2009 Share Posted July 23, 2009 You could use a form class to build a form along with the validation. Most php frameworks( such as Zend Framework and CakePHP) include functionality to create forms a lot easier. I do think that having a form with a hundred fields is a bit of an overkill. I mean If I saw a form with a 100 fields I would simply click the back button or some other action to go to another page. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.