Table of Contents
回复讨论(解决方案)
Home Backend Development PHP Tutorial 提交后获取不到值

提交后获取不到值

Jun 23, 2016 pm 01:58 PM
submit Obtain

提交后只能获取到时间 但获取不到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);}}
Copy after login


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")				});
Copy after login


回复讨论(解决方案)

$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);}}
Copy after login

<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>
Copy after login


以前是这样的  这样可以获取到值   但是想改成上面那样 就获取不到值了



提交留言

用这个



提交留言

用这个

我想结合js 才没用这个的 
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1664
14
PHP Tutorial
1268
29
C# Tutorial
1242
24
How to get file extension in Python? How to get file extension in Python? Sep 08, 2023 pm 01:53 PM

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.

Use math.Max ​​function to get the maximum value in a set of numbers Use math.Max ​​function to get the maximum value in a set of numbers Jul 24, 2023 pm 01:24 PM

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

Where to get Google security code Where to get Google security code Mar 30, 2024 am 11:11 AM

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.

How to get the last element of LinkedHashSet in Java? How to get the last element of LinkedHashSet in Java? Aug 27, 2023 pm 08:45 PM

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

Get the latest updates now: Fix missing latest updates Get the latest updates now: Fix missing latest updates Nov 08, 2023 pm 02:25 PM

If the "Get the latest updates as soon as they become available" option is missing or grayed out, you may be running a Developer Channel Windows 11 build, and this is normal. For others, issues arise after installing the KB5026446 (22621.1778) update. Here's what you can do to get back the "Get the latest updates as soon as they become available" option. How do I get the "Get the latest updates as soon as they're available" option back? Before starting any of the solutions below, make sure to check for the latest Windows 11 updates and install them. 1. Use ViVeTool to go to the Microsoft Update Catalog page and look for the KB5026446 update. Download and reinstall the update on your PC

MySQL transaction processing: the difference between automatic submission and manual submission MySQL transaction processing: the difference between automatic submission and manual submission Mar 16, 2024 am 11:33 AM

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

Simple JavaScript Tutorial: How to Get HTTP Status Code Simple JavaScript Tutorial: How to Get HTTP Status Code Jan 05, 2024 pm 06:08 PM

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

C++ program to get the imaginary part of a given complex number C++ program to get the imaginary part of a given complex number Sep 06, 2023 pm 06:05 PM

Modern science relies heavily on the concept of plural numbers, which was first established in the early 17th century by Girolamo Cardano, who introduced it in the 16th century. The formula for complex numbers is a+ib, where a holds the html code and b is a real number. A complex number is said to have two parts: the real part <a> and the imaginary part (<ib>). The value of i or iota is √-1. The plural class in C++ is a class used to represent complex numbers. The complex class in C++ can represent and control several complex number operations. Let's take a look at how to represent and control the display of plural numbers. imag() member function As mentioned above, complex numbers are composed of real part and imaginary part. To display the real part we use real()

See all articles