Form Validation and Arrays |
How can I check if a post variable is an array?
If I try this: $this->form_validation->set_rules('data[]', 'Post Data', 'is_array'); It checks all the array elements with is_array. I want to check if 'data' is an array. Any ideas? Thanks, Brian
well you talk about how to check variable post in array, don't you ? so i will not disscuss about validation ya,
please check here just tested in yours, cause it working for me Code: $itemName = $this->input->post('your input type name'); Hope this help you !
Once you call form validation for a field with square brackets, you already seem to know it's an array, don't you?
I guess your form contains multiple fields with name="data[]". These fields are posted as an array. In your form validation routine, you must check which of those have a value or not. |
Welcome Guest, Not a member yet? Register Sign In |