• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Validating a field that is an Array


I would like to know how I can validate an array field.

The contact_number needs to be an array of phone numbers and in my view code, I use a for loop to display the array contents.

My problem is how to define the
in the validation code.

Below is my code that does not work:

My Controller has the following code:

$fields['contact_number[]'] = "phone number";

My view has the following:
&lt;?php for($i=0; $i < 5; $i++): ?&gt;
      <td width="10%" style="text-align: center;">&lt;?php echo $i + 1; ?&gt;</td>
      <td width="59%">&lt;?php echo $this->formatnumber->format( $this->validation->contact_number[$i] ); ?&gt;</td>
      <td width="10%"></td>
      <td width="10%"></td>
&lt;?php endfor; ?&gt;

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.