php普通的表单增加 表单 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 form action="' 表示表单提交到本页你的代码不全,没有看到服务端脚本 form action="'就是提交到当前页面,你只需要刷新一下即可看到运行结果 action为空是提交到当前文件。看你的代码没有接收数据的语句。如果以上代码是完整的,是不可能入库的。 为空是提交到当前脚本页面,如果你是采用MVC模式那你就看下与V对应的C是哪个?如果你是采用的最原始的混编那你贴出的代码就少了。 它怎么加进来数据了 代码 页面全在这C 的代码<?phpclass HomeAction extends UserAction{ public $token; public $home_db; public function _initialize() { parent::_initialize(); $this->token=$this->_session('token'); $this->home_db=M('home'); $this->canUseFunction('shouye'); } //配置 public function set(){ $home=$this->home_db->where(array('token'=>session('token')))->find(); if(IS_POST){ //$info = str_replace("\r\n",' ',$_POST['info']); //$_POST['info'] = str_replace('"','',$info); $token = session('token'); S("homeinfo_".$token,NULL); if($home==false){ $this->all_insert('Home','/set'); }else{ $_POST['id']=$home['id']; $this->all_save('Home','/set'); } }else{ $this->assign('home',$home); $this->display(); } } public function plugmenu(){ $where=array('token'=>$this->token); $menuArr=array('tel','memberinfo','nav','message','share','home','album','email','shopping','membercard','activity','weibo','tencentweibo','qqzone','wechat','music','video','recommend','other'); $home=$this->home_db->where(array('token'=>session('token')))->find(); $plugmenu_db=M('site_plugmenu'); if (!$home){ $this->error('请先配置3g网站信息',U('Home/set',array('token'=>session('token')))); }else { S("homeinfo_".$this->token,NULL); if(IS_POST){ //保存版权信息和菜单颜色 $this->home_db->where($where)->save(array('plugmenucolor'=>$this->_post('plugmenucolor'),'copyright'=>$this->_post('copyright'))); //保存各个菜单 //先删除原来的 $plugmenu_db->where($where)->delete(); //添加 foreach ($menuArr as $m){ $row=array('token'=>$this->token); $row['name']=$m; $row['url']=$this->_post('url_'.$m); $row['taxis']=intval($_POST['sort_'.$m]); $row['display']=intval($_POST['display_'.$m]); //if (strlen(trim($row['url']))){ $plugmenu_db->add($row); //} } $this->success('设置成功',U('Home/plugmenu',array('token'=>$this->token))); }else { $homeInfo=$this->home_db->where($where)->find(); if (!$homeInfo['plugmenucolor']){ $homeInfo['plugmenucolor']='#ff0000'; } // $this->assign('userGroup',$this->userGroup); // $this->assign('homeInfo',$homeInfo); $menus=$plugmenu_db->where($where)->select(); $menusArr=array(); foreach ($menus as $m){ $menusArr[$m['name']]=$m; } $this->assign('menus',$menusArr); $this->display(); } } } }?>HTML 页面<include file="Public:head"/><!-- top ↑ --><script src="/tpl/static/artDialog/jquery.artDialog.js?skin=default"></script><script src="/tpl/static/artDialog/plugins/iframeTools.js"></script><script type="text/javascript" src="/tpl/User/default/common/js/select/js/jquery.js"></script><script type="text/javascript" src="/tpl/static/audioplayer/inc/jquery.jplayer.min.js"></script> <script type="text/javascript" src="/tpl/static/audioplayer/inc/jquery.mb.miniPlayer.js"></script> <link rel="stylesheet" type="text/css" href="/tpl/static/audioplayer/css/miniplayer.css" title="style" media="screen"/> <script type="text/javascript"> $(function () { $(".audio").mb_miniPlayer({ width: 200, inLine: false, onEnd: playNext }); function playNext(player) { var players = $(".audio"); document.playerIDX = player.idx + 1 <= players.length - 1 ? player.idx + 1 : 0; players.eq(document.playerIDX).mb_miniPlayer_play(); } }); </script> <div class="content" <if condition="session('isQcloud') eq true">style="float:center;"</if>><div class="cLineB"> <h4>首页回复配置 </h4><a href="javascript:history.go(-1);" class="right btnGrayS vm" style="margin-top:-27px">返回</a> </div> <div class="msgWrap bgfc"> <form class="form" method="post" action="" enctype="multipart/form-data"> <table class="userinfoArea" style=" margin:0;" border="0" cellspacing="0" cellpadding="0" width="100%"> <tbody> <tr> <th valign="top"><span class="red">*</span>关键词:</th> <td> <span class="red">首页 或者 home —— 当用户输入该关键词时,将会触发此回复。</span></td> </tr> <tr> <th width="120">回复标题:</th> <td><input type="text" name="title" value="{pigcms:$home.title}" class="px" style="width:550px;"></td> </tr> <tr> <th width="120">内容介绍:</th> <td><textarea style="width:560px;height:75px" name="info" id="info" class="px">{pigcms:$home.info}</textarea><br/>最多填写120个字</td> </tr> <tr> <th>回复图片:</th> <td><input type="text" name="picurl" id="picurl" value="{pigcms:$home.picurl}" class="px" style="width:550px;"> <script src="/tpl/static/upyun.js?{pigcms::date('YmdHis',time())}"></script><a href="###" onclick="upyunPicUpload('picurl',700,420,'{pigcms:$token}')" class="a_upload">上传</a> <a href="###" onclick="viewImg('picurl')">预览</a></td> </tr> <tr> <th>3G网站背景:</th> <td><input type="hidden" name="homeurl" id="homeurl" value="{pigcms:$home.homeurl}" class="px" style="width:550px;"><a href="?g=User&m=Flash&a=index&token={pigcms:$token}&tip=2">请在首页背景图中设置</a></td> </tr> <tr> <th>背景音乐:</th> <td> <table><tr><if condition="$home.musicurl neq ''"><td><a style="width:120px;float:left" id="musicurl_src" class="audio {skin:'blue'}" href="{pigcms:$home.musicurl}">音乐播放</a></td></if><td> <input type="text" class="px" name="musicurl" value="{pigcms:$home.musicurl}" id="musicurl" style="width:200px;float:left" onchange="$('#musicurl_src').attr('href',this.value"> <a href="###" onclick="upyunPicUpload('musicurl',0,0,'{pigcms:$token}')" class="a_upload">上传</a> <a href="###" onclick="chooseFile('musicurl','music')" class="a_upload">选择</a></td></tr></table> </td> </tr> <tr> <th>公司Logo:</th> <td><input type="text" name="logo" id="logo" value="{pigcms:$home.logo}" class="px" style="width:550px;"> <a href="###" onclick="upyunPicUpload('logo',1500,1000,'{pigcms:$token}')" class="a_upload">上传</a> <a href="###" onclick="viewImg('logo')">预览</a><br/> </td> </tr> <tr> <th>第三方接口:</th> <td><input type="text" name="apiurl" value="{pigcms:$home.apiurl}" class="px" style="width:550px;"><br/> 只适用于引用第三方3G网站的链接</td> </tr> <th> </th> <td> <button type="submit" name="button" class="btnGreen">保存</button> <a href="javascript:history.go(-1);" class="btnGray vm">取消</a> </td> </tr> </tbody> </table> </form> </div> </div><if condition="session('isQcloud') neq true"> <include file="Public:footer"/> </if> 建议你看下all_insert和all_save你就会找到你的答案了。 新手怎样学PHP 新手请教:phpexcel1.0.0使用出错(急)! windows7下iis配置php PHP与数据库的问题 为什么我用simplexml_load_file就出错,我用的是php 5.2.5 版本,是这个版本不支持该功能,还是别的原因。谢高手帮助。 如何查询除一条资料以外的其他所有资料? nusoap出错,救命呀 急急急!!!!!为什么图片传不上去 php的缓存问题 如何删除多维数组中指定元素? php curl 传 json 数据实例 求助,php+mysql如何根据拼音首字母查询汉字数据库?
你的代码不全,没有看到服务端脚本
就是提交到当前页面,你只需要刷新一下即可看到运行结果
如果以上代码是完整的,是不可能入库的。
它怎么加进来数据了 代码 页面全在这C 的代码
<?php
class HomeAction extends UserAction{
public $token;
public $home_db;
public function _initialize() {
parent::_initialize();
$this->token=$this->_session('token');
$this->home_db=M('home');
$this->canUseFunction('shouye');
}
//配置
public function set(){
$home=$this->home_db->where(array('token'=>session('token')))->find();
if(IS_POST){
//$info = str_replace("\r\n",' ',$_POST['info']);
//$_POST['info'] = str_replace('"','',$info);
$token = session('token');
S("homeinfo_".$token,NULL);
if($home==false){
$this->all_insert('Home','/set');
}else{
$_POST['id']=$home['id'];
$this->all_save('Home','/set');
}
}else{
$this->assign('home',$home);
$this->display();
}
}
public function plugmenu(){
$where=array('token'=>$this->token);
$menuArr=array('tel','memberinfo','nav','message','share','home','album','email','shopping','membercard','activity','weibo','tencentweibo','qqzone','wechat','music','video','recommend','other');
$home=$this->home_db->where(array('token'=>session('token')))->find();
$plugmenu_db=M('site_plugmenu');
if (!$home){
$this->error('请先配置3g网站信息',U('Home/set',array('token'=>session('token'))));
}else {
S("homeinfo_".$this->token,NULL);
if(IS_POST){
//保存版权信息和菜单颜色
$this->home_db->where($where)->save(array('plugmenucolor'=>$this->_post('plugmenucolor'),'copyright'=>$this->_post('copyright')));
//保存各个菜单
//先删除原来的
$plugmenu_db->where($where)->delete();
//添加
foreach ($menuArr as $m){
$row=array('token'=>$this->token);
$row['name']=$m;
$row['url']=$this->_post('url_'.$m);
$row['taxis']=intval($_POST['sort_'.$m]);
$row['display']=intval($_POST['display_'.$m]);
//if (strlen(trim($row['url']))){
$plugmenu_db->add($row);
//}
}
$this->success('设置成功',U('Home/plugmenu',array('token'=>$this->token)));
}else {
$homeInfo=$this->home_db->where($where)->find();
if (!$homeInfo['plugmenucolor']){
$homeInfo['plugmenucolor']='#ff0000';
}
//
$this->assign('userGroup',$this->userGroup);
//
$this->assign('homeInfo',$homeInfo);
$menus=$plugmenu_db->where($where)->select();
$menusArr=array();
foreach ($menus as $m){
$menusArr[$m['name']]=$m;
}
$this->assign('menus',$menusArr);
$this->display();
}
}
}
}?>
HTML 页面<include file="Public:head"/>
<!-- top ↑ -->
<script src="/tpl/static/artDialog/jquery.artDialog.js?skin=default"></script>
<script src="/tpl/static/artDialog/plugins/iframeTools.js"></script>
<script type="text/javascript" src="/tpl/User/default/common/js/select/js/jquery.js"></script>
<script type="text/javascript" src="/tpl/static/audioplayer/inc/jquery.jplayer.min.js"></script>
<script type="text/javascript" src="/tpl/static/audioplayer/inc/jquery.mb.miniPlayer.js"></script>
<link rel="stylesheet" type="text/css" href="/tpl/static/audioplayer/css/miniplayer.css" title="style" media="screen"/>
<script type="text/javascript">
$(function () { $(".audio").mb_miniPlayer({
width: 200,
inLine: false,
onEnd: playNext
}); function playNext(player) {
var players = $(".audio");
document.playerIDX = player.idx + 1 <= players.length - 1 ? player.idx + 1 : 0;
players.eq(document.playerIDX).mb_miniPlayer_play();
}
});
</script>
<div class="content" <if condition="session('isQcloud') eq true">style="float:center;"</if>><div class="cLineB">
<h4>首页回复配置 </h4><a href="javascript:history.go(-1);" class="right btnGrayS vm" style="margin-top:-27px">返回</a>
</div>
<div class="msgWrap bgfc">
<form class="form" method="post" action="" enctype="multipart/form-data">
<table class="userinfoArea" style=" margin:0;" border="0" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<th valign="top"><span class="red">*</span>关键词:</th>
<td>
<span class="red">首页 或者 home —— 当用户输入该关键词时,将会触发此回复。</span></td>
</tr>
<tr>
<th width="120">回复标题:</th>
<td><input type="text" name="title" value="{pigcms:$home.title}" class="px" style="width:550px;"></td>
</tr>
<tr>
<th width="120">内容介绍:</th>
<td><textarea style="width:560px;height:75px" name="info" id="info" class="px">{pigcms:$home.info}</textarea><br/>最多填写120个字</td>
</tr>
<tr>
<th>回复图片:</th>
<td><input type="text" name="picurl" id="picurl" value="{pigcms:$home.picurl}" class="px" style="width:550px;"> <script src="/tpl/static/upyun.js?{pigcms::date('YmdHis',time())}"></script><a href="###" onclick="upyunPicUpload('picurl',700,420,'{pigcms:$token}')" class="a_upload">上传</a> <a href="###" onclick="viewImg('picurl')">预览</a></td>
</tr>
<tr>
<th>3G网站背景:</th>
<td><input type="hidden" name="homeurl" id="homeurl" value="{pigcms:$home.homeurl}" class="px" style="width:550px;"><a href="?g=User&m=Flash&a=index&token={pigcms:$token}&tip=2">请在首页背景图中设置</a></td>
</tr>
<tr>
<th>背景音乐:</th>
<td>
<table><tr><if condition="$home.musicurl neq ''"><td><a style="width:120px;float:left" id="musicurl_src" class="audio {skin:'blue'}" href="{pigcms:$home.musicurl}">音乐播放</a></td></if><td> <input type="text" class="px" name="musicurl" value="{pigcms:$home.musicurl}" id="musicurl" style="width:200px;float:left" onchange="$('#musicurl_src').attr('href',this.value"> <a href="###" onclick="upyunPicUpload('musicurl',0,0,'{pigcms:$token}')" class="a_upload">上传</a> <a href="###" onclick="chooseFile('musicurl','music')" class="a_upload">选择</a></td></tr></table>
</td>
</tr>
<tr>
<th>公司Logo:</th>
<td><input type="text" name="logo" id="logo" value="{pigcms:$home.logo}" class="px" style="width:550px;"> <a href="###" onclick="upyunPicUpload('logo',1500,1000,'{pigcms:$token}')" class="a_upload">上传</a> <a href="###" onclick="viewImg('logo')">预览</a><br/> </td>
</tr>
<tr>
<th>第三方接口:</th>
<td><input type="text" name="apiurl" value="{pigcms:$home.apiurl}" class="px" style="width:550px;"><br/> 只适用于引用第三方3G网站的链接</td>
</tr>
<th> </th>
<td>
<button type="submit" name="button" class="btnGreen">保存</button>
<a href="javascript:history.go(-1);" class="btnGray vm">取消</a>
</td>
</tr>
</tbody>
</table>
</form>
</div>
</div>
<if condition="session('isQcloud') neq true"> <include file="Public:footer"/>
</if>