提交后获取不到值
提交后只能获取到时间 但获取不到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);}}
<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>
以前是这样的 这样可以获取到值 但是想改成上面那样 就获取不到值了
用这个
用这个
我想结合js 才没用这个的

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

A file extension in Python is a suffix appended to the end of a file name to indicate the format or type of the file. It usually consists of three or four characters, a file name followed by a period, such as ".txt" or ".py". Operating systems and programs use file extensions to determine what type of file it is and how it should be processed. Recognized as a plain text file. File extensions in Python are crucial when reading or writing files because it establishes the file format and the best way to read and write data. For example, the ".csv" file extension is the extension used when reading CSV files, and the csv module is used to process the files. Algorithm for obtaining file extension in Python. Manipulate file name string in Python.

Google Authenticator is a tool used to protect the security of user accounts, and its key is important information used to generate dynamic verification codes. If you forget the key of Google Authenticator and can only verify it through the security code, then the editor of this website will bring you a detailed introduction on where to get the Google security code. I hope it can help you. If you want to know more Users please continue reading below! First open the phone settings and enter the settings page. Scroll down the page and find Google. Go to the Google page and click on Google Account. Enter the account page and click View under the verification code. Enter your password or use your fingerprint to verify your identity. Obtain a Google security code and use the security code to verify your Google identity.

Use the math.Max function to obtain the maximum value in a set of numbers. In mathematics and programming, it is often necessary to find the maximum value in a set of numbers. In Go language, we can use the Max function in the math package to achieve this function. This article will introduce how to use the math.Max function to obtain the maximum value in a set of numbers, and provide corresponding code examples. First, we need to import the math package. In the Go language, you can use the import keyword to import a package, as shown below: import"mat

Retrieving the last element from a LinkedHashSet in Java means retrieving the last element in its collection. Although Java has no built-in method to help retrieve the last item in LinkedHashSets, there are several effective techniques that provide flexibility and convenience to efficiently retrieve this last element without breaking the insertion order - a must for Java developers issues effectively addressed in its application. By effectively applying these strategies in their software projects, they can achieve the best solution for this requirement LinkedHashSetLinkedHashSet is an efficient data structure in Java that combines HashSet and

The size of a file is the amount of storage space that a specific file takes up on a specific storage device, such as a hard drive. The size of a file is measured in bytes. In this section, we will discuss how to implement a java program to get the size of a given file in bytes, kilobytes and megabytes. A byte is the smallest unit of digital information. One byte equals eight bits. One kilobyte (KB) = 1,024 bytes, one megabyte (MB) = 1,024KB, one gigabyte (GB) = 1,024MB and one terabyte (TB) = 1,024GB. The size of a file usually depends on the type of file and the amount of data it contains. Taking a text document as an example, the file size may be only a few kilobytes, while a high-resolution image or video file may be

JavaScript tutorial: How to get HTTP status code, specific code examples are required. Preface: In web development, data interaction with the server is often involved. When communicating with the server, we often need to obtain the returned HTTP status code to determine whether the operation is successful, and perform corresponding processing based on different status codes. This article will teach you how to use JavaScript to obtain HTTP status codes and provide some practical code examples. Using XMLHttpRequest

MySQL transaction processing: the difference between automatic submission and manual submission. In the MySQL database, a transaction is a set of SQL statements. Either all executions are successful or all executions fail, ensuring the consistency and integrity of the data. In MySQL, transactions can be divided into automatic submission and manual submission. The difference lies in the timing of transaction submission and the scope of control over the transaction. The following will introduce the difference between automatic submission and manual submission in detail, and give specific code examples to illustrate. 1. Automatically submit in MySQL, if it is not displayed

Although the general operations of domestic mobile phones are very similar, there are still some differences in some details. For example, different mobile phone models and manufacturers may have different dual-SIM installation methods. Erzhenwo 12Pro, a new mobile phone, also supports dual-SIM dual standby, but how should dual-SIM be installed on this phone? How to install dual SIM on Realme 12Pro? Remember to turn off your phone before installation. Step 1: Find the SIM card tray: Find the SIM card tray of the phone. Usually, in the Realme 12 Pro, the SIM card tray is located on the side or top of the phone. Step 2: Insert the first SIM card. Use a dedicated SIM card pin or a small object to insert it into the slot in the SIM card tray. Then, carefully insert the first SIM card.
