在codeigniter表单验证中从数组中提取值

I have a form like this :

<input type='text' name='category[]' value='firstcategory'>
<input type='text' name='category[]' value='secondcategory'>

and a validation rule like this

$this->form_validation->set_rules('category[]', 'Category Name', 'checkcategory');

how can I get the values firstcategory and secondcategory in my checkcategory callback?

After I try print_r($_POST) it showed me something like :

Array ( [category] => Array ( [0] => 'firstcategory' [1] => 'secondcategory' ) )

So in order to achieve what I want, I've tried something like this on my checkcategory callback :

$neddle = array('firstcategory' => $str['category'][0], 'secondcategory' => $str['category'][1]);

But it didn't work.

You can't, yet.

There's a feature request for this that will be fulfilled for CodeIgniter 3.1.0: https://github.com/bcit-ci/CodeIgniter/issues/193