title: Codeigniter - Search form with multiple parameters
body: <p>Basically this code functions by pulling data entered by the user in the form and connects to the model which performs a query search based on the inputted information. </p>
  
  <p>This code works but it only works when i enter both the $no and $first fields. But i need it to work so the user will be able to enter the $no and leave the other variable empty.</p>
  
  <p>I thought i could use some sort of OR statement but i'm unsure how to implement it. Any help would be appreciated and i apologize if its not clear enough i'm fairly new when it comes to codeigniter.</p>
  
  <p>Controller</p>
  
  <pre><code>    public function query()
  
  {
  
      $no = $this-&gt;input-&gt;post('no');
      $first = $this-&gt;input-&gt;post('first');
      $this-&gt;load-&gt;model("test");
           $data['query']=$this-&gt;test-&gt;query($no,$first);
          $this-&gt;load-&gt;view('query',$data);
  
  }
  </code></pre>
  
  <p>Model</p>
  
  <pre><code>function query($no, $first)
  {
  
   return $query = $this-&gt;db-&gt;get_where('table', array('no' =&gt; $no,
   'first' =&gt; $first ))-&gt;result();
  
  }
  </code></pre>
  
  <p>View</p>
  
  <pre><code>&lt;?php foreach($query as $row): ?&gt;
  &lt;tr&gt; 
      &lt;td&gt;&lt;?php echo $row-&gt;no; ?&gt;&lt;/td&gt;
      &lt;td&gt;&lt;?php echo $row-&gt;date; ?&gt;&lt;/td&gt;
      &lt;td&gt;&lt;?php echo $row-&gt;first; ?&gt;&lt;/td&gt;
  
  
      &lt;/tr&gt;
      &lt;?php endforeach; ?&gt;
  </code></pre>