title: Codeigniter captcha
body: <p>I ran into a small problem what i cant figure out.</p>
  
  <p>I would liked to use the captcha helper without database but nothing seems to be working.</p>
  
  <p>in the construct i created a variable which generates a random string</p>
  
  <pre><code>   public function __construct()
     {
        parent::__construct();
        $this-&gt;rand = random_string('numeric', 4);
     }
  </code></pre>
  
  <p>passed this variable to the captcha values like this:</p>
  
  <pre><code> $vals = array(
       'word'   =&gt; $this-&gt;rand,
       'img_path'  =&gt; './captcha/',
       'img_url'   =&gt; base_url() . 'captcha/',
       'font_path'    =&gt; './system/fonts/texb.ttf',
       'img_width'    =&gt; '150',
       'img_height' =&gt; 30,
       'expiration' =&gt; 7200
       );
  
   $cap = create_captcha($vals);
  </code></pre>
  
  <p>and wanted to validate it with a callback function like this</p>
  
  <pre><code>   function captcha_check()
     {
        if($this-&gt;input-&gt;post('code') != $this-&gt;rand)
        {
           $this-&gt;form_validation-&gt;set_message('captcha_check', 'Wrong captcha code, hmm are you the Terminator?');
           return false;
        }
     }
  </code></pre>
  
  <p>And nothing works, the problem is, captcha code is show with the image, the problem is the validation, if i type in the correct numbers in my captcha field it always showing me the error, no mather what i type in, could please someone give me a hint?</p>
  
  <p>html:</p>
  
  <pre><code>  &lt;label for="code"&gt;Count please &lt;/label&gt;
        &lt;?php echo $rand; ?&gt;
    &lt;input type="text" id="code" name="code" class="span3" /&gt;
  </code></pre>
  
  <p>validation line:</p>
  
  <pre><code>$this-&gt;form_validation-&gt;set_rules('code', 'Captcha', 'required|callback_captcha_check');
  </code></pre>