jon*_*nas -2 html php forms arrays
我有这个表格
<form action = "put the data to a single PHP array" method="post">
<input name="a" type="text" />
<input name="b" type="text" />
<input name="c" type="text" />
<input name="d" type="text" />
<input type="button">
</form>
Run Code Online (Sandbox Code Playgroud)
条件是当用户填写表单并单击提交按钮时,我想将数据放入一个 PHP 数组中。数据应该按照文本输入字段的排列方式排序。我怎样才能做到这一点?
请帮助我的代码。谢谢!
像这样更改输入的名称:
<form action = "put the data to a single PHP array" method="post">
<input name="a[]" type="text" />
<input name="a[]" type="text" />
<input name="a[]" type="text" />
<input name="a[]" type="text" />
<input type="button"/>
</form>
Run Code Online (Sandbox Code Playgroud)
然后,您可以按如下方式检索数组:
$values = $_POST['a'];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5297 次 |
| 最近记录: |