Home > Backend Development > PHP Tutorial > tpphp一个表单提交多个需要循环的数据怎么处理

tpphp一个表单提交多个需要循环的数据怎么处理

WBOY
Release: 2016-06-20 12:45:11
Original
1252 people have browsed it


就像图里面有三个需要提交的数据,一次性可能有多条或者一条,后台怎么来处理呢?
只有一个form

 数据都在一个form里面,还是说需要一条数据一个form呢?


回复讨论(解决方案)

提交跳转页面可以提交和返回,没有问题,但是不太友好,想用ajax做,

$.ajax({ 		 url: "index.php?g=Home&m=Index&a=actChoice&json=1",		 data: {"choice":"value","field_id":"value"}, 		 type:'POST',		 success: function(result){         jDialog.alert(result);         }});		
Copy after login

怎么把值放到data里面去呢,如图1一样,有多条和一条的情况。

2345678$.ajax({          url: "index.php?g=Home&m=Index&a=actChoice&json=1",         data: $('#Form1').serialize(),          type:'POST',         success: function(result){         jDialog.alert(result);         }});
Copy after login
Copy after login

服务器
$_POST['choice'];//这样接收

2345678$.ajax({          url: "index.php?g=Home&m=Index&a=actChoice&json=1",         data: $('#Form1').serialize(),          type:'POST',         success: function(result){         jDialog.alert(result);         }});
Copy after login
Copy after login

服务器
$_POST['choice'];//这样接收


谢谢大神,用你的方法解决了。非常感谢!
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template