[need help]how to call the dropdown if there is more than a model-view-controller?

I'm making a search function for website online library.

I've made a model-view-controller for each search books, magazines, journals, and cd. (There are four model-view-controller for each category)

How do I make each model-view-controller for it so I can call via the dropdown? so that when I input the title and then choose the category that I want in the dropdown, the functionality can perform a search according to categories that have been selected in the dropdown.

I attach a model-view-controller to a book, due to a different category just adjust it.

    class PencarianModel extends Model
        function PencarianModel()
        /* Menampilkan Hasil Pencarian */
        function SearchResult($perPage,$uri,$judul)
             $this->db->select('mp.judul, mp.pengarang,, k.kategori, mp.status_pustaka, p.nama_penerbit')
                     ->from('tbl_master_properti mp')
                     ->join('tbl_penerbit p', 'mp.id_penerbit=p.id_penerbit')
                     ->join('tbl_kategori k', 'k.id_kategori=mp.id_kategori');
            if(!empty($judul)) {
            $getData = $this->db->get('', $perPage, $uri);
            if($getData->num_rows() > 0)
                return $getData->result_array();
                return null;

<div class="clear"></div>
<div id="content_box" class="grid_24 box">
<caption>Masukkan judul yang akan anda cari</caption>
&lt;form id="form_pencarian" name="form_pencarian" method="post" action="&lt;?=base_url();?&gt;/search/"&gt;
  &lt;input name="judul" type="text" id="judul" size="30" maxlength="255" class="inputbox" value="&lt;?=$judul;?&gt;"/&gt;&nbsp;&nbsp;
  &lt;input name="submit" type="submit" id="submit" value="Cari" class="button"/&gt;
<option>- - -Pilih Kategori- - -</option>
  <option>Tugas Akhir</option>

<hr />
   <legend><caption>Hasil Pencarian</caption></legend>
   <table width="100%" border="1">
  <col align="left" />
  <col align="left" />
  <col align="right" />
    <th>Kategori Buku</th>
    <th>Status (ada/tidak di perpustakaan)</th>

    //ListBuku Hasil Pencarian
    if(count($ListBuku) > 0) {
        foreach($ListBuku as $row)
                echo "<tr>
                        <td width=100 align=\"left\" valign=\"middle\">&nbsp;</td>
                        <td width=500>
                        <br>Judul :</br>
                        <span> ".$row['judul']."</span>
                        <br>Pengarang :</br>
                        <span>". $row['pengarang'] ."</span>
                        <br>Kategori Buku :</br>
                        <span>". $row['kategori'] ."</span>
                        <br>Penerbit :</br>
                        <span>". $row['nama_penerbit'] ."</span>
                        <br>Status buku :</br>
                        <span>". $row['status_pustaka'] ."</span>
        echo $this->pagination->create_links();
    } else {
        echo "<div><strong>Hasil pencarian tidak ditemukan.</strong></div>";


<div class="clear"></div>

    class Search extends Controller
        function Search()
        function index()
                $data['judul'] = $this->input->post('judul');
                //set session user data untuk pencarian, untuk paging pencarian
                $this->session->set_userdata('sess_judul', $data['judul']);
            } else {
                $data['judul'] = $this->session->userdata('sess_judul');
            $this->db->like('judul', $data['judul']);
            //Pagination init
            $pagination['base_url']     = base_url().'index.php/ulang37/index/page/';
            $pagination['total_rows']     = $this->db->count_all_results();
            $pagination['full_tag_open'] = "<p><div class=\"pagination\">";
            $pagination['full_tag_close'] = "</div></p>";
            $pagination['cur_tag_open'] = "<span class=\"current\">";
            $pagination['cur_tag_close'] = "</span>";
            $pagination['num_tag_open'] = "<span class=\"disabled\">";
            $pagination['num_tag_close'] = "</span>";
            $pagination['per_page']     = "5";
            $pagination['uri_segment'] = 4;
            $pagination['num_links']     = 4;
            $data['ListBuku'] = $this->pencarianmodel->SearchResult($pagination['per_page'],$this->uri->segment(4,0),$data['judul']);
            $data['current'] = 'search';
            $data['content'] = 'pencarian';
            $this->load->view('container', $data);

I'm not THAT skilled yet, but isen't it better to maken one model, one controller and one view?
Each category has his own ID so you can simply ask which ID(categorie) and the view will load that ID(categorie)

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.