如何在CodeIgniter中对字段名称的关联数组执行验证

I am taking my fields name as associative array in html code in CodeIgniter but am running into trouble when I validate it.

Here is the code I'm using:

View Page

{<input type="text" name="name[name]">
<?php echo form_error('name[name]'); ?>}

Controller

{$this->form_validation->set_rules('name[name]','name','required');}

How might I solve this?

you don't repeat the name inside the brackets, they are kept empty like:

   <input type="text" name="name[]">
    <?php echo form_error('name[]'); ?>

Validation

    $this->form_validation->set_rules('name[]','name','required');

note you only would do this if the form field 'name' is occurring more then once in the form.