作者 anyv
1 个管道 的构建 通过 耗费 0 秒

首页

... ... @@ -14,6 +14,8 @@ use think\Db;
class IndexController extends HomeBaseController
{
//首页显示
public function index()
{
... ... @@ -23,4 +25,19 @@ class IndexController extends HomeBaseController
$this -> assign('lunbo',$lunbo);
return $this->fetch(':index');
}
//底部联系人添加
public function fadd(){
$data['name'] = input('post.name');
$data['phone'] = input('post.phone');
$data['content'] = input('post.content');
$shuju = Db::name('contacts') -> insert($data);
if($shuju){
return true;
}else{
return false;
}
}
}
... ...
... ... @@ -4,11 +4,11 @@
<div class="footer_left">
<h1>联系我们</h1>
<div class="footer_input">
<input type="text" placeholder="请输入您的姓名">
<input type="text" placeholder="请输入您的电话">
<input type="text" name="name" placeholder="请输入您的姓名">
<input type="text" name="phone" placeholder="请输入您的电话">
</div>
<textarea placeholder="请输入您的留言"></textarea>
<div class="in_btn">
<textarea placeholder="请输入您的留言" id="content"></textarea>
<div class="in_btn" onclick="lianxi()">
提交
</div>
</div>
... ... @@ -22,4 +22,19 @@
<p>Copyright © 2005 - 2019 jiemin biotech(tianjin),inc.</p>
</div>
</div>
</div>
\ No newline at end of file
</div>
<script>
function lianxi(){
name = $("input[name='name']").val();
phone = $("input[name='phone']").val();
contnt = $("#content").val();
$.post("{:url('Index/fadd')}", {name:name,phone:phone,content:contnt}, function(data) {
if(data){
alert('提交成功');
}else{
alert('提交失败');
}
});
}
</script>
\ No newline at end of file
... ...