Home > Backend Development > PHP Tutorial > php的post表单提交获取name名的问题咨询

php的post表单提交获取name名的问题咨询

WBOY
Release: 2016-06-23 13:14:29
Original
1059 people have browsed it

表单:无限添加输入框

比如我添加了3个输入框,显示为:



提交post后,我要在php中获取form1的值form2值....
用for循环怎么达到以下的这种效果?
for 略..{
formm=$_GET[form$i];
s=formm;
}
输出为
s=$_GET[form1]的值
s=$_GET[form2]的值
s=$_GET[form3]的值


回复讨论(解决方案)

foreach($_GET as  $key=>$value){     echo $key.'='.$value;    //s=???   你S=每个值你确认要这样?
Copy after login
Copy after login

foreach($_GET as  $key=>$value){     echo $key.'='.$value;    //s=???   你S=每个值你确认要这样?
Copy after login
Copy after login



是,因为我是要存储在同一个字段里,应该是S.=
不过,可能我没表达清楚。
$key.'='.$value; 这方法貌似不能打到我的要求
比如说:这张表单里是这样的

type="hidden"




增加按钮,点击后加载





提交后,发送的post为:title form url form1 url1 form2 url2
php中
num =通过增加按钮获得的数值
i=1
当i <= num i++
我怎么获取
form url form1 url1 form2 url2 的值?达到以下的效果
for (i=1;i <= num i++){
......
s .= form url
}

输出为:
s .= $_GET[form1] url1...的值
s .= $_GET[form2] url2...的值
.......

$a = array(  'url1' => 1,  'url2' => 2,  'url3' => 3,  'url4' => 4,);for($i=1; $i<=4; $i++)  echo $a['url'.$i], PHP_EOL; 
Copy after login
1
2
3
4

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