title: php captcha session doesn't update
body: <p>I have this code:</p>
  
  <p><strong>captcha.php:</strong></p>
  
  <pre><code>session_start();
  class Captcha {
      protected $code;
      protected $width = 35;
      protected $height = 150;
  
      function __construct() { 
          $this-&gt;code = substr(sha1(mt_rand()), 17, 6); 
          $_SESSION['captcha'] = $this-&gt;code;
      }
  
      function getCode(){
          return $this-&gt;code;
      }
  
      function showImage() {
               // here comes the code that builds the image.
               // it works fine!
  
      }
  }
  
  
  $image = new Captcha();
  
  $image-&gt;showImage();
  </code></pre>
  
  <p>And in my login form I have:</p>
  
  <pre><code>&lt;iframe src="includes/captcha.php" frameborder="0" height="65" width="180"&gt;&lt;/iframe&gt;
  </code></pre>
  
  <p>if I <code>print_r($_SESSION)</code>, the <code>$_SESSION['captcha']</code> always in <strong>delay</strong> : it contains the previous <code>captcha</code> code , and not the current which is being shown.</p>
  
  <p>What should I do?</p>