提交後擷取不到值

來源:互聯網
上載者:User
提交後只能擷取到時間 但擷取不到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);}}


html



js
$(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);}}

 


以前是這樣的 這樣可以擷取到值 但是想改成上面那樣 就擷取不到值了


用這個


用這個



我想結合js 才沒用這個的
  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.