php 手册学习 HTML 的 <form> 中建立数组

 1 <!DCOTYPE html>
 2 <html>
 3 <body>
 4 <form action="index.php" method="post">
 5   <input type="text" name="name" />
 6     <select name="var[]" multiple="yes">
 7     <input name="AnotherArray[]" />
 8   <input name="AnotherArray[]" />
 9   <input name="AnotherArray[email]" />
10   <input name="AnotherArray[phone]" />  
11   <input type="image" src="123.jpg" name="foo" />   
12 
13 </form>
14 </body>
15 
16 
17 </html>

返回结果:

array(4) { ["name"]=> string(0) "" ["AnotherArray"]=> array(4) { [0]=> string(2) "21" [1]=> string(2) "12" ["email"]=> string(2) "21" ["phone"]=> string(2) "21" } ["foo_x"]=> string(3) "497" ["foo_y"]=> string(3) "189" }

array(4) { ["name"]=> string(0) "" ["AnotherArray"]=> array(4) { [0]=> string(2) "21" [1]=> string(2) "12" ["email"]=> string(2) "21" ["phone"]=> string(2) "21" } ["foo_x"]=> string(3) "497" ["foo_y"]=> string(3) "189" }

posted @ 2019-07-09 19:08  没事就更  阅读(319)  评论(0编辑  收藏  举报