title: how to get new value through session
body: <p>I want to get the value of php variable through session. Each time when i click on refresh image of captcha,php variable i.e $code contains new value. I used session to get that value. I m getting the value only once but when i click on refresh image the value in session is not changing. How can i get the value repeatedly using session here is my code:</p>
  
  <p>code of captchaImages.php:</p>
  
  <pre><code>$captcha = new CaptchaCode();
  $code = str_encrypt($captcha-&gt;generateCode(6));
  $captcha1 = new CaptchaImages();
  $captcha1-&gt; GenerateImage($width,$height,str_decrypt($code));
  session_start();
  $_SESSION['code_captcha'] = $code;
  </code></pre>
  
  <p>code of my index.php where i want to get new value of session:</p>
  
  <pre><code>function refresh_captcha()
      {
  
          jQuery.get('&lt;?php echo CAPTCHA_PLUGIN_URL . "/captcha_images.php"?&gt;', function(encoded_code) {
              &lt;?php
              session_start();
              ?&gt;
              jQuery('#security_check').val("&lt;?php echo $_SESSION['code_captcha'];?&gt;");
              jQuery('#captcha_img').attr("src","&lt;?php echo CAPTCHA_PLUGIN_URL . "/captcha_images.php"?&gt;");
          });
      }
  </code></pre>