title: Validating multidimensional arrays in Code Igniter with form_validation library
body: <p>I'm having a weird problem with the form_validation module of code igniter. I'm trying to validate multi dimensional arrays from the form post, but its not working as expected. I've used this a hundred times (exaggeration) with standard form posts so I'm familiar with it. </p>
  
  <p>My form post looks like this </p>
  
  <pre><code>Array
  (
      [location_edit_id] =&gt;
      [theImage] =&gt; 
      [thePDF] =&gt; 
      [loc] =&gt; Array
      (
          [name] =&gt; 
          [content_1] =&gt; 
          [content_2] =&gt; 
          [opening_hours] =&gt; 
          [seats] =&gt;
      )
      [ad] =&gt; Array
      (
          [address_1] =&gt; 
          [address_2] =&gt; 
          [address_3] =&gt; 
          [town_city] =&gt; 
          [county_id] =&gt;
          [region_id] =&gt;
          [postcode] =&gt; 
          [telephone] =&gt; 
          [email] =&gt; 
      )
   )
  </code></pre>
  
  <p>According to the <a href="http://codeigniter.com/user_guide/libraries/form_validation.html#arraysasfields" rel="nofollow noreferrer">docs</a> - the action in my controller needs to look like this if I want to validate the $_POST['loc']['name'] </p>
  
  <pre><code>$this-&gt;validation-&gt;set_rules( 'loc[name]', 'Location Name', 'required');
  
  if ($this-&gt;validation-&gt;run() == FALSE)
  {
      die( "did not validate" );
  } 
  else
  {
      die( "validated" );
  }
  </code></pre>
  
  <p>no matter what I do, this always validates even if $_POST['loc']['name'] is empty. I've examined the library file libraries/Validation.php and I cant see anywhere where this would actually work (as its always just looking for variable name matches - not arrays), so I'm not sure whats going on. </p>
  
  <p>EDIT: I'm using Code igniter version 1.7.2 which is the latest stable release. </p>