作者 anyv
1 个管道 的构建 通过 耗费 0 秒

分类编辑

... ... @@ -42,10 +42,19 @@ class LabelController extends AdminBaseController{
*/
public function classify_edit(){
$id = $this -> request -> param();
$data = Db::name('classification') -> where('id',$id['id']) -> find();
$this -> assign('data',$data);
return $this -> fetch();
if($this -> request -> isPost()){
$data = Db::name('classification') -> update($_POST);
if($data){
$this -> success('保存成功',url('Label/classify_edit',array('id'=>$_POST['id'])));
}else{
$this -> error('保存失败!');
}
}else{
$id = $this -> request -> param();
$data = Db::name('classification') -> where('id',$id['id']) -> find();
$this -> assign('data',$data);
return $this -> fetch();
}
}
... ...
... ... @@ -16,6 +16,7 @@
<input class="form-control" type="text" name="name"
id="title" required value="{$data.name}" placeholder="请输入分类名称"/>
</td>
<input type="hidden" name="id" value="{$data.id}">
</tr>
</table>
<div class="form-group">
... ...