title: codeigniter: how to redirect after login to current controller (php_self in regular php)
body: <p>Well it's not really a problem but I check if the user exist and log them in and redirect to site/members_area, but I don't want to send the user to a specific page but i want to reload the current controller.
  So if I login in index/home I would like to be redirected at index/home, how should I proceed?</p>
  
  <p>in regular php I would put in the action to redirect to current page</p>
  
  <pre><code>&lt;?php echo $_SERVER['PHP_SELF']; ?&gt;
  </code></pre>
  
  <p>This is the code in the framework</p>
  
  <pre><code>function validate_credentials()
      {       
          $this-&gt;load-&gt;model('membership_model');
          $query = $this-&gt;membership_model-&gt;validate();
  
          if($query) // if the user's credentials validated...
          {
              $data = array(
                  'username' =&gt; $this-&gt;input-&gt;post('username'),
                  'is_logged_in' =&gt; true
              );
              $this-&gt;session-&gt;set_userdata($data);
              redirect('site/members_area'); //&lt;-- this line here should be dynamic
          }
          else // incorrect username or password
          {
              $this-&gt;index();
          }
      }
  </code></pre>