TP 更新データベース
<!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --> //个人档案 public function geren(){ if(!isset($_SESSION[C("USER_AUTH_KEY")])){ $msg="请登录"; }else{ $msg=$_SESSION[C("USER_AUTH_KEY")]; } $this->assign('msg',$msg); //==================获取登录信息============================ $gr=M("admin"); $baide=$gr->select(); $this->assign("baide",$baide); $this->assign("title",'极限互动办公自动化系统'); $this->display(); } public function upgr(){//修改edit 内容 header("Content-Type:text/html; charset=utf-8"); $Form = M("admin"); $data['id'] = $_GET['id']; $data['name'] = $_GET['name']; $data['password'] = $_GET['password']; $data['sex'] = $_GET['sex']; $data['bumen'] = $_GET['bumen']; $data['TEL'] = $_GET['TEL']; $data['QQ'] = $_GET['QQ']; $data['email'] = $_GET['email']; $data['dizhi'] = $_GET['dizhi']; $data['img'] = $_GET['img']; if($data){ $upgr=$Form->where('id='.$data['id'])->save($data); if($upgr){ echo "<script type='text/javascript'>alert('更新成功');window.navigate('geren');</script>"; }else{ echo "<script type='text/javascript'>alert('更新失败');window.navigate('geren');</script>"; } } }
<!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --> <volist name="baide" id="baide"> <tr> <td>{$baide.name}</td> <td>{$baide.sex}</td> <td>{$baide.TEL}</td> <td>{$baide.QQ}</td> <td>{$baide.email}</td> <td>{$baide.dizhi}</td> <td><img src="../../{$baide.img}" width="25" height="30"/></td> <td> <a href="__URL__/upgr/id/{$baide.id}">编辑档案</a> </td> </tr> </volist>
<!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --> <ボリスト名="baide" id="baide"> <form action="__URL__/upgr" method="get" name="geren"> <テーブル幅="200" ボーダー="1"> <tr> <td width="44">姓</td> <td width="140"><input type="text" name="name" value="{$baide.name}" /></td> </tr> <tr> <td width="44">秘密コード</td> <td width="140"><input type="text" name="password" value="{$baide.password}" /></td> </tr> <tr> <td>性别</td> <td><input type="text" name="sex" value="{$baide.sex}" /></td> </tr> <tr> <td>公司职位</td> <td><input type="text" name="weizhi" value="{$baide.weizhi}" /></td> </tr> <tr> <td>公司部门</td> <td><input type="text" name="bumen" title="{$baide.bumen}" value="{$baide.bumen}" /></td> </tr> <tr> <td>電話番号</td> <td><input type="text" name="TEL" value="{$baide.TEL}" /></td> </tr> <tr> <td>QQ</td> <td><input type="text" name="QQ" value="{$baide.QQ}" /></td> </tr> <tr> <td>メール</td> <td><input type="text" name="email" value="{$baide.email}" /></td> </tr> <tr> <td>住址</td> <td><input type="text" name="dizhi" value="{$baide.dizhi}" /></td> </tr> <tr> <td>画像</td> <td><input type="text" name="img" value="{$baide.img}" /></td> </tr> <tr> <td><input type="submit" name="保存" value="保存" /></td> <td><input type="reset" name="清空" value="清空" /></td> </tr> </テーブル> </フォーム> </ボリスト> <div class="clear"></div>