【发布时间】:2014-05-14 05:32:44
【问题描述】:
我想更新下面的字段,但我的表单不起作用。它不存储数据我应该怎么做。我在字段中使用了 jquery 手风琴,因此它将单击他要编辑的项目,然后更新字段然后提交。但它不起作用。
查看
foreach($people as $row){
echo "<h3>".$row->service."</h3>";
echo "<form action='".base_url()."some_controller/updateCI' method='post'> <div>Service ID: <input type=text name=id value='".$row->id."' size=27px/><br>Service Name: <input type=text name=name value='".$row->service."'><input type='button' class='classname' value='Save'/></form></div>";
}
?>
控制器
public function updateCI(){
$this->load->model('some_model');
$id = $this->input->post('id');
$servName = $this->input->post('name');
$success = $this->some_model->updateCI($id,$servName);
if($success == TRUE)
$this->editCI_page(TRUE);
else $this->editCI_page(FALSE);
}
型号
public function updateCI($id,$servName){
//$name = $this->db->escape_str($name);
$appID = $this->db->escape_str($id);
$ciName = $this->db->escape_str($servName);
$queryStr = "UPDATE appwarehouse.service SET id='$appID',service='$ciName' WHERE id = '$appID';";
$query = $this->db->query($queryStr);
return $query;
}
【问题讨论】:
-
所以为每个字段创建一个表单?
-
是的,它是如何工作的
标签: php forms codeigniter