[eluser]Isuru[/eluser]
I created this form.
Code:
<!-- Search -->
<div id="search" class="noprint">
<?php
echo form_open("/index.php/welcome/search");
$data = array("name" => "term","id" => "term","maxlength" => "64","size" => "30");
echo form_input($data);
echo form_submit("submit","search");
echo form_close(); ?>
</div> <!-- /search -->
And this is the model
Code:
function search($term){
$data = array();
$this->db->select('id, title, shortdesc');
$this->db->like('title', $term);
$this->db->or_like('shortdesc', $term);
$this->db->order_by('title');
$this->db->where('status', 'active');
$Q = $this->db->get('jobs');
if($Q -> num_rows > 0){
foreach($Q->result_array() as $row){
$data[] = $row;
}
}
$Q -> free_result();
return $data;
}
And this is the controller.
Code:
function search(){
$search['results'] = $this->jobs->search($this->input->pos('term'));
$data['title'] = 'Job Board| Search Results';
$this->load->vars($data);
$this->load->view('search_result');
}
But I can't get it to work.
I added 'form' helper to autoload.php
I am new to CI. So please help me.