diff --git a/app/admin/controller/LabelController.php b/app/admin/controller/LabelController.php index 73b2de9..6400cd2 100644 --- a/app/admin/controller/LabelController.php +++ b/app/admin/controller/LabelController.php @@ -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(); + } } diff --git a/public/themes/admin_simpleboot3/admin/label/classify_edit.html b/public/themes/admin_simpleboot3/admin/label/classify_edit.html index dc75904..eda8594 100644 --- a/public/themes/admin_simpleboot3/admin/label/classify_edit.html +++ b/public/themes/admin_simpleboot3/admin/label/classify_edit.html @@ -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">