后台
function 指定的模板名称(){
$this->updates('users');
}
function upmyInfo(){
$this->doSV('users');
}
封装的函数
/**
+----------------------------------------------------------
* updates指定表修改函数
+----------------------------------------------------------
* @var array
* @access public
+----------------------------------------------------------
*/
function updates($surface){
//实例化模型$surface为自己指定的表名
$content=D($surface);
//接收待修改信息的id,需要从自己点击修改的数据的id通过地址栏传过来id
//$id=$_GET['id'];
$list=$content->find($_SESSION['user_id']);
//填充数据执行修改前台接收{$content}为指定的数据的id对应的所有的数据
$this->assign("content",$list);
}
/**
+----------------------------------------------------------
*doSV修改后的数据提交到指定数据表的函数
+----------------------------------------------------------
* @var array
* @access public
+----------------------------------------------------------
*/
function doSV($surfac){
//echo $surfac;
$content=D($surfac);
if($content->create()){
//执行插入操作,执行成功后,返回新插入的数据库的id
if($content->save()){
$this->success("修改成功!",__URL__."/member_guanli?id=".$_SESSION['user_id']);
}else{
$this->error("修改失败!");
}
}else{
//把错误信息提示给用户看
$this->error($content->getError());
}
}
前台
<script type="text/javascript" src="__PUBLIC__/js/upssx.js"></script>
<script language="javascript" type="text/javascript">
function convert(){
var obj = document.getElementById('s1'); //定位id
var index = obj.selectedIndex; // 选中索引
var text = obj.options[index].text; // 选中文本
var obj2 = document.getElementById('s2'); //定位id
var index2 = obj2.selectedIndex; // 选中索引
var text2 = obj2.options[index2].text; // 选中文本
var obj5 = document.getElementById('s3'); //定位id
var index5 = obj5.selectedIndex; // 选中索引
var text5 = obj5.options[index5].text; // 选中文本
var text3=text+"省"+text2+"市"+" "+text5;
//alert(text3);
var text4=text;
document.getElementById('PrCi').value=text3;
document.getElementById('PrCi2').value=text4;
document.getElementById('PrCix').value=text3;
document.getElementById('PrCiu').value=text3;
}
function value(){
document.getElementById('values').focus();
}
</script>
<form name="form1" action="__URL__/upmyInfo" method="post">
<table width="614" height="365" border="0" cellpadding="0" cellspacing="0" id="guanli_biaodan">
<tr>
<td width="110" rowspan="2"><img src="__PUBLIC__/img/member_13.jpg"/></td>
<td width="91" align="center" >名称:</td>
<td width="402" ><input class="guanli_text" type="text" value="{$content.users_name}" name="users_name"/><input type="hidden" name="users_id" value="<php>echo $_SESSION['user_id']</php>"/></td>
</tr>
<tr>
<td height="88" align="center">性别:</td>
<td>
<if condition="$content.users_sex eq '0'">
<label>
<input type="radio" name="users_sex" value="0" checked="checked"/>
男</label>
<label>
<input type="radio" name="users_sex" value="1" />
女</label>
<elseif condition="$content.users_sex eq '1'"/>
<label>
<input type="radio" name="users_sex" value="0" />
男</label>
<label>
<input type="radio" name="users_sex" value="1" checked="checked" />
女</label>
</if>
</td>
</tr>
<tr>
<td height="54" align="right">所在地区:</td>
<td colspan="2">
<input type="hidden" name="PrCi" id="PrCi"/>
<input type="hidden" name="PrCi2" id="PrCi2"/>
<input type="hidden" name="address" id="PrCix"/>
<input type="hidden" name="users_address" id="PrCiu"/>
<select class="guanli_select" name="s1" id="s1">
<option value="-选择省份-" >-选择省份-</option>
</select>
<select class="guanli_select" name="select" id="s2">
<option value="-选择市-" >-选择省市-</option>
</select>
<select style="display:none;" id="s3" >
<option value="">市,县级市</option>
</select>
<script type="text/javascript" src="__PUBLIC__/js/downssx.js"></script>
</td>
</tr>
<tr>
<td align="right">联系电话:</td>
<td colspan="2"><input class="guanli_text" name="users_tel" type="text" value="{$content.users_moblie}"/></td>
</tr>
<tr>
<td align="right">手机:</td>
<td colspan="2"><input class="guanli_text" name="users_moblie" type="text" value="{$content.users_moblie}"/></td>
</tr>
<tr>
<td align="right">邮箱:</td>
<td colspan="2"><input class="guanli_text" name="user_email" type="text" value="{$content.user_email}"/></td>
</tr>
<tr>
<td> </td>
<td><input class="guanli_btn" type="submit" value="确认提交"/></td>
<td> </td>
</tr>
</table>
</form>
更多详细信息请查看
java教程网 http://www.itchm.com/forum-59-1.html
分享到:
相关推荐
简单的thinkphp3.2修改当前账号密码并带数据库与实现中间件控制器
有关ThinkPHP项目及本文档的最新资料,请及时访问ThinkPHP项目主站 http://thinkphp.cn。 本文档的版权归ThinkPHP文档小组所有,本文档及其描述的内容受有关法律的版权保护,对本文档内容的任何形式的非法复制,...
简单的基于thinkphp的登陆模块,前段使用bootstrap。包含登陆,退出,修改密码。多设备支持。
基于ThinkPHP修改的一个page类,支持自定义页面样式。
有关ThinkPHP项目及本文档的最新资料,请及时访问ThinkPHP项目主站 http://thinkphp.cn 。 本文档及其描述的内容受有关法律的版权保护,对本文档内容的任何形式的非法复制,泄露或散 布,将导致相应的法律责任。
亲测thinkphp3.1.3完美支持php7
修改thinkphp-exam / application / database.php的配置,更改数据库账号:root,密码:root,数据库:exam 后台访问地址: 账号:admin密码:admin888 如果喜欢我的项目请给我一个星哦, ThinkPHP 5.0 ThinkPHP5在...
1.到网站后台小程序配置填写微信小程序的相关资料 2.修改App/Common/Conf/db.php 数据库连接参数; 3.修改App/Api/Conf/config.php 微信小程序的appid、secret、mchid、key、notify_url,SELF_ROOT的参数; 4....
TP3.1 默认是不支持php7的,这份框架代码已修改支持php最新版 7.0、7.1、7.2 主要修改其中几个已经废弃的几个函数为PHP7支持的函数用于代替使用,不影响效率,经测试函数执行效率依然比旧版本更高
以下小编给大家列出了三种实现thinkphp批量更新数据的方法,写的不好还请见谅,有意见欢迎提出,共同学习进步! 方法一: //批量修改 data二维数组 field关键字段 参考ci 批量修改函数 传参方式 function batch_...
基于thinkphp的cms学生学籍管理系统 功能模块:1.管理员模块 管理学生和用户(班主任和年级主任) 2.教师模块 对学生进行增删改 对自己密码修改 操作步骤: 1.首先将数据库相关操作完成 建立数据库连接 数据表的...
thinkphp把数据库内容生成word,且可以下载到本地,一个类放到指定文件夹里,另一个则是控制器,自行修改即可。
采用thinkphp3.2.3实现的后台登录功能,适合新手学习,大牛就不要下了
本文件包含了thinkphp框架,bootstrap框架,mysql数据库文件,实现增删改查
主要介绍了Thinkphp使用mongodb数据库实现多条件查询方法,修改了mongodb驱动文件来实现复合查询、多条件查询,需要的朋友可以参考下
根据thinkphp官方分页类修改,弥补不足,优化分页逻辑,加入跳转页数,实现最具用户体验的分页类(类似discuz论坛分页)
1.此项目是基于Thinkphp3.2.3+easyui做的权限管理系统,所有后台管理系统均可基于此项目开发。 2.项目集成php反射自动生成API文档,通过访问http://你的IP或者域名/文件地址/tpcs/index.php/Api/Doc/index.html即可...
包括栏目管理,文章管理,注册会员管理,会员发布需求的管理,评论管理,友情链接管理,系统设置,系统管理员管理,前台会员类型,密保问题管理,文件管理系统(包括上传,重命名,移动,修改等) 其他太复杂的功能...
3、ThinkPHP\Library\Vendor\wxpay\lib\WxPay.Config.php 微信小程序的appid、appsecret、mchid、key参数修改; 4、ThinkPHP\Library\Vendor\WeiXinpay\lib\WxPay.Config.php 微信小程序的appid、appsecret、mchid...