I work with CodeIgniter. I need to make multiple array in my form and sort the form by the name.
My html :
<input type="text" value="<?= set_value('joueur[0][nom]') ?>" name="joueur[0][nom]">
My php :
foreach ($_POST as $form => $listPersons)
{
foreach($listPersons as $numPerson => $listFields)
{
foreach ($listFields as $field => $value)
{
$fieldName = "{$form}[{$numPerson}][{$field}]";
/* in switch case ...*/
default:
$this ->form_validation
->set_rules($fieldName, 'Tous les champs sont obligatoires', 'trim|required|xss_clean');
break;
}
}
}
}
}
}
And the var_dump :
string(18) "
(xss_clean)
"
My input value is "hello" or other correct string. I don't understand why the form error return (xss_clean) :-/
Thank you for your help !