我想要的只是當我點擊我的按鈕時回顯'a'。提交按鈕不起作用codeigniter
我在view
下面的代碼:
<?php echo form_submit('btnSearch', 'Search');?>
而且這個代碼在我的控制器:
if(isset($_POST['btnSearch']))
{
echo 'a';
}
這是我在控制器全碼:
public function index() {
//table
$data_umat = $this->backend_m->get_umat()->result();
$this->table->set_heading(
'No',
'Nama',
'Kelas',
'Alamat',
'Sekolah',
'Nomor Telepon',
'Keterangan'
);
$table_template = array('table_open' => '<table border="1" id="custom_table">');
$this->table->set_template($table_template);
$no = 1;
foreach($data_umat as $list_temp)
{
$this->table->add_row(
$no++,
$list_temp->nama,
$list_temp->kelas,
$list_temp->alamat,
$list_temp->sekolah,
$list_temp->no_tlpn,
$list_temp->keterangan
);
}
$data = $this->backend_m->get_kelas()->result();
foreach($data as $row)
{
$data['list_kelas'][$row->kelas_id] = $row->kelas;
}
$data['table'] = $this->table->generate();
$this->load->view('backend/home_v', $data);
if(isset($_POST['btnSearch']))
{
echo 'a';
}
}
編輯 這是我view
全碼:
<body>
<div id="header"><h1>HEADER</h1></div>
<div id="side_menu">
<ul>
<li><a href="#">Daftar Umat</a></li>
<li><a href="#">Daftar Pengurus</a></li>
<li><a href="#">Absensi</a></li>
</ul>
</div>
<div id="content">
<form>
<p>Search by Kelas :
<?php echo form_dropdown('kelas_id', $list_kelas, 'id="ddl_kelas1"');?> -
<?php echo form_dropdown('kelas_id', $list_kelas, 'id="ddl_kelas2"');?>
</p>
<?php echo form_submit('btnSearch', 'Search');?>
<?php echo $table?>
</form>
</div>
</body>
但「一」是不是當我按一下按鈕顯示。我的錯誤在哪裏?謝謝:d
顯示您的視圖代碼也 – 2013-03-19 13:11:14
@EdwinAlex羅傑先生說:d – 2013-03-19 13:12:01
在哪裏形成的? – itachi 2013-03-19 13:14:20