title: How to get model value to controller?
body: <p>I am using codeigniter 3.1 .</p>
  
  <p>I want to pass posted data through model, but to pass login i need to get model value to controller ?</p>
  
  <p>How to get model value to controller?</p>
  
  <p><strong>Controller</strong></p>
  
  <pre><code>&lt;?php 
  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
  
  class Login extends CI_Controller 
  {
      public function __construct() 
      {
           parent::__construct();
           $this-&gt;load-&gt;model("user_login");
      }
  
      public function index()
      {
  
          $post = $this-&gt;input-&gt;post("post", true);
  
          if ($this-&gt;user_login-&gt;check($post)) {
              if ($this-&gt;user_login-&gt;logins == "pass") {  
                  echo "valid";
              } else {
                  echo "Invalid";
              }
          }
      }
  } 
  ?&gt;
  </code></pre>
  
  <p><strong>Model</strong></p>
  
  <pre><code>&lt;?php
  
  class User_Login extends CI_Model 
  {
      var $logins=false;
  
      public function check($post) 
      {
          $results = $this-&gt;db-&gt;where('username', $post)
                              -&gt;get('users');
  
          if($results-&gt;num_rows() &gt; 0){
              $this-&gt;logins = "pass";
          } else {
              $this-&gt;logins = "fail";
          }
      }
  }
  ?&gt;
  </code></pre>