<?php class AiXinAction extends Action{ //上传爱心协议 public function shangchuan() { if(empty($_POST)) { $this->display(); } else { $model = M("fanwe_xieyi"); $model->create(); $re = $model->add(); if($re) { echo "添加成功"; } else { echo "添加失败"; } } }
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!--注意顺序--> <script type="text/javascript" charset="utf-8" src="http://localhost/tp/editor/utf8-php/ueditor.config.js"></script><!--绝对路径--> <script type="text/javascript" charset="utf-8" src="http://localhost/tp/editor/utf8-php/ueditor.all.min.js"></script> <script type="text/javascript" charset="utf-8" src="http://localhost/tp/editor/utf8-php/lang/zh-cn/zh-cn.js"></script> <title>无标题文档</title> <style type="text/css"> div{ width:100%; } </style> </head> <body> <h3 align="center">共献爱心协议</h2> <form action="__URL__/shangchuan" method="post" > <input type="hidden" value="" name="id" /> 名 字:<input type="text" name="name" style=" width:80%; border:medium; outline:none" /><hr /> 协 议:<textarea name="picture" rows="1" cols="200px" id="fp" style="background:transparent; border:none; outline:none"></textarea><hr /> 时 间:<input type="text" name="time" style="border:0px; outline:none" /><hr /> <input type="submit" value="上传" /> </form> <div align="center"> <script id="editor" type="text/plain" style=" width:100%;height:400px;"></script> </div><br /> <div align="center"> <button onclick="getContent()">存入图片</button></div> <br /> <br /> <br /> <br /> <br /> <br /> <script type="text/javascript"> var ue = UE.getEditor('editor'); function getContent() { var str = UE.getEditor('editor').getContent(); document.getElementById("fp").textContent = str ; } </script> <div></div> </body> </html>