HI
I am trying to implement code igniter form validation to my application.
everything fine but when the data is multidimensional Array form validation not working.
here is my array format.
$reqdata=Array
(
[0] => Array
(
[mobile] => 8888888888
[subgroup] => Array
(
[0] => Array
(
[fieldd_name] => fieldd_Value
)
[1] => Array
(
[fieldg_name] => fieldg_Value
)
)
)
[1] => Array
(
[mobile] => 9999999999
[subgroup] => Array
(
[0] => Array
(
[fieldd_name] => fieldd_Value
)
[1] => Array
(
[fieldd_name] => fieldg_Value
)
)
)
)
i tried this format but not working properly
$this->CI->form_validation->pass_array($reqdata);
$counts=count($reqdata);
for($j=0;$j<$counts;$j++){
$countsub=count($reqdata[$j]['subgroup']);
for($i=0;$i<contsub;$i++){
$this->CI->form_validation->set_rules('subgroup['. $i .'][fieldg_name]', 'Age', 'required_strict|Name');
}
}
can any one suggest proper way.
Thanks in Advance
I am trying to implement code igniter form validation to my application.
everything fine but when the data is multidimensional Array form validation not working.
here is my array format.
$reqdata=Array
(
[0] => Array
(
[mobile] => 8888888888
[subgroup] => Array
(
[0] => Array
(
[fieldd_name] => fieldd_Value
)
[1] => Array
(
[fieldg_name] => fieldg_Value
)
)
)
[1] => Array
(
[mobile] => 9999999999
[subgroup] => Array
(
[0] => Array
(
[fieldd_name] => fieldd_Value
)
[1] => Array
(
[fieldd_name] => fieldg_Value
)
)
)
)
i tried this format but not working properly
$this->CI->form_validation->pass_array($reqdata);
$counts=count($reqdata);
for($j=0;$j<$counts;$j++){
$countsub=count($reqdata[$j]['subgroup']);
for($i=0;$i<contsub;$i++){
$this->CI->form_validation->set_rules('subgroup['. $i .'][fieldg_name]', 'Age', 'required_strict|Name');
}
}
can any one suggest proper way.
Thanks in Advance