title: Redirect error in codeIgniter
body: <p>I am trying to the code</p>
  
  <pre><code>function validate(){
          $this-&gt;load-&gt;library('session');
          $this-&gt;load-&gt;model('inventory/inventoryModel');
          $result = $this-&gt;inventoryModel-&gt;validateUser();
          if($result == 1){
              $data = array(
                  'username' =&gt; $this-&gt;input-&gt;post('username'),
                  'is_loged_in' =&gt; TRUE 
              );
              $this-&gt;session-&gt;set_userdata($data);
          }
          else{
              $this-&gt;index();
              redirect('inventory/validate');
          }
      }
  </code></pre>
  
  <p>and getting the error in chrome "This web page has a redirect loop"
  what is solution?</p>