Skip to content

Instantly share code, notes, and snippets.

@jmlweb
Created May 31, 2012 10:18
Show Gist options
  • Save jmlweb/2842459 to your computer and use it in GitHub Desktop.
Save jmlweb/2842459 to your computer and use it in GitHub Desktop.
Ejemplo de validación para campos con array
<?php
//asumiendo que campo es un campo de formulario de tipo array
foreach($_POST as $k1 => $v1) {
if($k1 === 'campo' && is_array($v1)) {
foreach($campo as $k2 => $v2) {
$this->form_validation->set_rules('campo['.$k2.']', 'campo'.$k2, 'required');
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment