title: Using variable in form validation 'field' in codeigniter
body: <p>I am trying to understand if there is a way to use a variable in 'field' with Codeigniter form validation.</p>
  
  <p>The form validation works properly when I use a text string, as shown in the first two arrays with fields 'product_name' and 'category_id', but it breaks when I try to use a variable as in the third array below.</p>
  
  <p>Here is the code, load form_validation in the function:</p>
  
  <pre><code>$this-&gt;load-&gt;library('form_validation');
  $this-&gt;form_validation-&gt;set_rules($this-&gt;add_product_page_one);
  </code></pre>
  
  <p>Array that defines form rules:</p>
  
  <pre><code>private $add_product_page_one = array(
      array(
          'field'   =&gt; 'product_name', 
          'label'   =&gt; 'Product Name', 
          'rules'   =&gt; 'required|max_length[255]|trim|xss_clean'
      ),
      array(
          'field'   =&gt; 'category_id',
          'label'   =&gt; 'Category', 
          'rules'   =&gt; 'required|integer'
      ),
      array(
          'field'   =&gt; $this-&gt;config-&gt;item('prod_filter_db_1'), 
          'label'   =&gt; $this-&gt;config-&gt;item('prod_filter_name_1'), 
          'rules'   =&gt; 'integer'
      )
  );
  </code></pre>
  
  <p>Error message:</p>
  
  <pre><code>Parse error: syntax error, unexpected '$this' (T_VARIABLE) in
   /Applications/MAMP/htdocs/appname/application/modules/company/controllers/add.php 
  </code></pre>