入门客AI创业平台(我带你入门,你带我飞行)
博文笔记

用PHP表单传递数组

创建时间:2014-05-08 投稿人: 浏览次数:107

                                                                         用PHP表单传递数组

test.php

formmethod="post" action="test2.php">
<input name="a[]" value="1" />
<input name="a[]" value="2" />
<input name="a[]" value="3" />
<input type="submit"  value="提交"/>
</form>

test2.php

<?php

print_r($_POST["a"]);
?>

结果:

Array( [0] => 1 [1] => 2 [2]=> 3 )

 

 

test.php

formmethod="post" action="test2.php">
<input name="a[4]" value="1" />
<input name="a[5]" value="2" />
<input name="a[6]" value="3" />
<input type="submit"  value="提交"/>
</form>

 

test2.php

<?php

print_r($_POST["a"]);
?>

结果:

Array( [4] => 1 [5] => 2 [6]=> 3 )

 

test.php

formmethod="post" action="test2.php">
<input name="a[11]" value="1"/>
<input name="a[22]" value="2"/>
<input name="a[33]" value="3"/>
<input type="submit"  value="提交"/>
</form>

 

test2.php

<?php

print_r($_POST["a"]);
?>

结果:

Array( [11] => 1 [22] => 2 [33]=> 3 )

 

一个动态生成的PHP表单数组,不依靠Javascript,就可以将很多数据仅仅以一个数组变量的方式提交上去
声明:该文观点仅代表作者本人,入门客AI创业平台信息发布平台仅提供信息存储空间服务,如有疑问请联系rumenke@qq.com。
  • 上一篇:没有了
  • 下一篇:没有了
未上传头像