Rumah >pembangunan bahagian belakang >tutorial php >提交后获取不到值
提交后只能获取到时间 但获取不到input的值
PHP
public function _FeedBack(){$post = $this->input->post(NULL, TRUE);$ac=$_REQUEST['ac'];if($ac=='activityuser_sn'){ $post['addtime'] = time();$post['txt_Name'] = $tel; $this->asdasd->insert($post);$prize_arr =array('success'=>'true'); //这是提交后填写订单成功的echo json_encode($prize_arr);}}
$(function() { window.requestAnimFrame = (function() { return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function(callback) { window.setTimeout(callback, 1000 / 60) } })(); var totalDeg = 360 * 3 + 0; var steps = []; var lostDeg = [36, 66, 96, 156, 186, 216, 276, 306, 336]; var prizeDeg = [6, 126, 246]; //var lostDeg = [36, 66, 96, 156, 186, 216, 276, 306, 336]; //var prizeDeg = [6,36, 66, 96, 126,156, 186, 216,246, 276, 306, 336]; var prize, sncode; var count = 0; var now = 0; var a = 0.01; var strmsg; var outter, inner, timer, running = false; function countSteps() { var t = Math.sqrt(2 * totalDeg / a); var v = a * t; for (var i = 0; i < t; i++) { steps.push((2 * v * i - a * i * i) / 2) } steps.push(totalDeg) } function step() { outter.style.webkitTransform = 'rotate(' + steps[now++] + 'deg)'; outter.style.MozTransform = 'rotate(' + steps[now++] + 'deg)'; if (now < steps.length) { requestAnimFrame(step) } else { running = false; setTimeout(function() { if (prize != null) { $("#sncode").text(sncode); var type = ""; if (prize == 1) { type = "一" } else if (prize == 5) { type = "二" } else if (prize == 9) { type = "三" } //alert(prize); $("#prizetype").text(type); $("#result").slideToggle(500); $("#outercont").slideUp(500) } else { //alert(strmsg); alert("谢谢您的参与,下次再接再厉") } }, 200) } } function start(deg) { deg = deg || lostDeg[parseInt(lostDeg.length * Math.random())]; running = true; clearInterval(timer); totalDeg = 360 * 5 + deg; steps = []; now = 0; countSteps(); requestAnimFrame(step) } window.start = start; outter = document.getElementById('outer'); inner = document.getElementById('inner'); i = 10; $("#inner").click(function() { if (running) return; if (count >= 2) { alert("已经 2 次了。"); return } if (prize != null) { alert("不能再参加了"); return } $.ajax({ url: "http://127.0.0.1/index.php", dataType: "json", data: { token: "o7MB9ji5fQRsE0ZoVAMU7SlnRyMI", ac: "activityuser", tid: "5", t: Math.random() }, beforeSend: function() { running = true; timer = setInterval(function() { i += 5; outter.style.webkitTransform = 'rotate(' + i + 'deg)'; outter.style.MozTransform = 'rotate(' + i + 'deg)' }, 1) }, success: function(data) { if (data.error == "invalid") { alert("已经3 次了。"); count = 3; clearInterval(timer); return } if (data.error == "getsn") { alert('已经中过,SN码为:' + data.sn); count = 3; clearInterval(timer); prize = data.prizetype; sncode = data.sn; start(prizeDeg[data.prizetype - 1]); return } if (data.success) { prize = data.prizetype; sncode = data.sn; //start(prizeDeg[data.prizetype - 1]) start(data.angle) } //if (data.error) { else{ prize = null; start() } running = false; count++ }, error: function() { prize = null; start(); running = false; count++ }, timeout: 4000 }) })});$("#save-btn").bind("click",function() { var btn = $(this); var tel = $("#tel").val(); if (tel == '') { alert("请输入手机号码"); return } var regu = /^[1][0-9]{10}$/; var re = new RegExp(regu); if (!re.test(tel)) { alert("请输入正确手机号码"); return } var submitData = { tid: 5, code: $("#sncode").text(), tel: tel, action: "setTel" }; $.post('http://127.0.0.1/index.php?ac=activityuser_sn', submitData, function(data) { if (data.success) { alert("提交成功,谢谢您的参与"); $("#result").slideUp(500); $("#outercont").slideToggle(500); running = false; return } else {alert("提交失败"); $("#result").slideUp(500); $("#outercont").slideToggle(500); } }, "json") });
$post['txt_Name'] = $tel;
$tel在哪里定义的?你的框架是直接post后就可以使用该变量了么?
$post = $this->input->post(NULL, TRUE);
打印¥post的值是什么
$post['txt_Name'] = $tel;
$tel在哪里定义的?你的框架是直接post后就可以使用该变量了么?
$post = $this->input->post(NULL, TRUE);
打印¥post的值是什么
public function _FeedBack(){$post = $this->input->post(NULL, TRUE);if(isset($post['btnSubmit'])){ $post['addtime'] = time(); $this->message->insert($post);}}
<form action="{site_url('message')}" method="post" name="form1" ><input name="tel" type="text" class="px" id="tel" value="" ><a id="showcard1" class="submit" href="javascript:void(0)" onClick="document.getElementById('btnSubmit').click()">提交留言</a><input type="submit" name="btnSubmit" value="btnSubmit" onClick="return CheckData();" id="btnSubmit" style="display:none" /></form>