Posted By

sebikovacs on 07/07/10


Tagged

form loop validation


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

scottwf
wireplay


Form validation loop


 / Published in: PHP
 

  1. $errors = array();
  2. $required_fields = array('menu_name','position','visible');
  3. foreach($required_fields as $field_name){
  4. if(!isset($_POST[$fieldname])|| empty($_POST[$fieldname])){
  5. $errors[]=$fieldname;
  6. }
  7. }

Report this snippet  

You need to login to post a comment.