【发布时间】:2018-03-27 03:49:37
【问题描述】:
如何为搜索框创建“请求”按钮?单击请求按钮时,在搜索框中键入的字母应保存在数据库中。我正在使用 CodeIgniter。
【问题讨论】:
-
您只需从 getbootstrap.com 获取引导按钮
标签: php html codeigniter
如何为搜索框创建“请求”按钮?单击请求按钮时,在搜索框中键入的字母应保存在数据库中。我正在使用 CodeIgniter。
【问题讨论】:
标签: php html codeigniter
你的看法
<form method="POST" action="your-action" >
<input type="text" name="search" />
<input type="submit" value="Search" />
</form>
控制器
public function function_name()
{
$data = $this->input->post('search');
$result = $this->model_name->function_name($data);
//$result is the result/output of your search
}
型号
public function function_name()
{
$this->db->insert('table-name', $data);
$this->db->select('*');
$this->db->from('table-name');
$this->db->like('column-name', $data);
return $this->db->get()->result_array(); //you can also use row_array() for one record only
【讨论】: