title: how to create search function in codeigniter
body: <p>I want to create simple search function. I follow some example. but I was unable to get results. please help me.   </p>
  
  <p>//view page</p>
  
  <pre><code>&lt;form class="navbar-form" role="search" action=" {{ base_url }}search/search_keyword" method = "post"&gt;
      &lt;div class="input-group"&gt;
          &lt;input type="text" class="form-control" placeholder="Search" name = "keyword"size="15px; "&gt;
          &lt;div class="input-group-btn"&gt;
              &lt;button class="btn btn-default " type="submit" value = "Search"&gt;&lt;i class="glyphicon glyphicon-search"&gt;&lt;/i&gt;&lt;/button&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>//controller</p>
  
  <pre><code>function search_keyword()
  {
      $keyword    =   $this-&gt;input-&gt;post('keyword');
      $data['results']    =   $this-&gt;mymodel-&gt;search($keyword);
      $this-&gt;twig-&gt;display('result_view.php',$this-&gt;data);
      //$this-&gt;load-&gt;view('result_view.php',$data);
  }
  </code></pre>
  
  <p>}</p>
  
  <p>//model</p>
  
  <pre><code>function search($keyword)
  {
      $this-&gt;db-&gt;like('item_name',$keyword);
      $query  =   $this-&gt;db-&gt;get('bracelets');
      return $query-&gt;result();
  }
  </code></pre>