title: JRequest::getVar is keeping previous values even after refreshing
body: <p>I am writing a mail function as a module in joomla 3. e mail works fine, but when i reload the page and insert a different email and send, but it seemed to return the previous email by  JRequest::getVar function. Is there a way to solve this issue? thanks in advance..</p>
  
  <p>this is the code i used:</p>
  
  <pre><code>    &lt;?php
  
      defined('_JEXEC') or die('Direct Access to this location is not allowed.');
  
      require_once(dirname(__FILE__) . DS . 'helper.php');
  
      //declaration
      $input = JFactory::getApplication()-&gt;input;
  
      $form_send = $input-&gt;get('form_send', 'notsend');
      $fanme = $input-&gt;get('firstName');
      $lname = $input-&gt;get('lastinput');
      $email = $input-&gt;get('email', 0 , 'STRING');
  
      $mail=false;
      $emailexist=false;
  
      echo '&lt;script&gt;
          var php_var = "chk is first:'.$email.'";
          alert(php_var);
          &lt;/script&gt;';
      switch ($form_send) {
  
          case 'send':
  
             if ((is_null($fanme) || is_null($lname) || is_null($email)) || (!filter_var($email, FILTER_VALIDATE_EMAIL))) {
                  echo '&lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Fields are empty or not valid.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br&gt;&lt;/div&gt;';
              } else {
  
                      $mail = ModLittleContactHelper::SendMail($email, $fanme, $lname);
                      echo '&lt;script&gt;
                      var php_var = "chk when mail sending:'.$email.'";
                      alert(php_var);
                      &lt;/script&gt;';
                     $input = JFactory::getApplication();//i have tried $app also
                     $input -&gt;setUserState('mod_mycontact.email', null);
  
                  }
                  //echo $respond
                  if (!$mail) {
                      echo 'Error sending email:';
                      require(JModuleHelper::getLayoutPath('mod_myecontact', 'default_tmpl'));
                  }else{
  
                      require(JModuleHelper::getLayoutPath('mod_mycontact', 'sendok_tmpl'));
                      break;
                  }
  
  
          default:
  
              require(JModuleHelper::getLayoutPath('mod_littlecontact', 'default_tmpl'));
              unset($var);
      }
      ?&gt;
  </code></pre>
  
  <p>@Mario this is the helper code: </p>
  
  <pre><code>    class ModLittleContactHelper{
          public function SendMail($email, $fname, $lname) {
  
  
          $body = "&lt;p style='font-family:arial;font-size:20px;'&gt;Hi  " . $fname . " " . $lname . ",&lt;/p&gt;";
          $body.="&lt;p style='font-family:arial;font-size:20px;'&gt;Welcome to Crowd Logistics! Please verify your email address below.&lt;/p&gt;&lt;br/&gt;&lt;br/&gt;";
          $body.= "&lt;hr&gt;&lt;br/&gt;";
          $body.= "&lt;p style='align:center;background-color:#40B3DF;font-family:arial;color:#FFFFFF;font-size:20px;'&gt;&lt;a href='http://suriyaarachchi.com/crowdlogistics/index.php?option=com_content&amp;view=article&amp;id=192' target='_blank'&gt;Verify " . $email . "&lt;/a&gt;&lt;/p&gt;";
          $body.= "&lt;br/&gt;&lt;hr&gt;&lt;br/&gt;";
          $body.="&lt;p style='text-align:right;font-family:arial;font-size:20px;'&gt;Or, paste this link into your browser:&lt;br/&gt;";
          $body.= "http://crowdlogistics/index.php?option=com_content&amp;view=article&amp;id=192&lt;br/&gt;&lt;br/&gt;";
          $body.= "Thanks.&lt;br/&gt;";
          $body.= "CrowdLogistics&lt;/p&gt;&lt;br/&gt;";
  
  
          $mailer = &amp; JFactory::getMailer();
                  $mailer-&gt;setSender('info@crowdlogistics.com');
                  $mailer-&gt;addRecipient($email);
                  $mailer-&gt;setSubject('Mail from CrowdLogistics - Confirm your email');
                  $mailer-&gt;setBody($body);
                  $mailer-&gt;IsHTML(true);
                  $send = &amp; $mailer-&gt;Send();
  
  
  
          return $send;
        }
  </code></pre>