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? Link to comment https://forums.phpfreaks.com/topic/167089-solved-how-to-do-validation/ 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 Link to comment https://forums.phpfreaks.com/topic/167089-solved-how-to-do-validation/#findComment-881017 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? Link to comment https://forums.phpfreaks.com/topic/167089-solved-how-to-do-validation/#findComment-881029 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. Link to comment https://forums.phpfreaks.com/topic/167089-solved-how-to-do-validation/#findComment-881030 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.