Home > php教程 > php手册 > 我要如何在HTML中建立<form>数组?

我要如何在HTML中建立<form>数组?

WBOY
Release: 2016-06-13 09:54:11
Original
1331 people have browsed it

要取得<form>传回数组,只要在PHP脚本中将<input>、<select> 或 <textarea> 等元素设成如下样子:
<input name="MyArray[]">
<input name="MyArray[]">
<input name="MyArray[]">
<input name="MyArray[]">
请注意在变量名后面的中括号,它就用来生成数组。你也可以在同一个名字中设定不同的数组元素群体,象下面的样子:
<input name="MyArray[]">
<input name="MyArray[]">
<input name="MyOtherArray[]">
<input name="MyOtherArray[]">
在PHP收到这个页面后,会建立二个数组,MyArray 与 MyOtherArray。需注意的是你在HTML中不用设定数组的索引!数组将依次将数据填入表格中。你可以使用数组函数库来处理这些数组。

Related labels:
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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template