我有一个页面,里面有多个
1<input name="cn" type="text"/>
请问怎样可以取得所有提交的数据?
直接用$cn只能取得最后一个数据,而不能取的所有的数据。
谢谢!
---------------------------------------------------------------
1<form action="test3.php" method="post">
2<input name="chkuser[]" type="hidden" value="1"/>
3<input name="chkuser[]" type="hidden" value="2"/>
4<input name="chkuser[]" type="hidden" value="3"/>
5<input type="submit"/>
6</form>
用类似于这种的写法, 像你的, 就改成
1<input name="cn[]" type="text"/>
在PHP中得到的就是cn数组.
---------------------------------------------------------------
1<input name="cn[]" type="text"/>
...
提交到php的是value不为空的对象
用js访问可以这样:
form["cn[]"][0].value // 表单中名为 cn[] 的第一个对象