【发布时间】:2019-02-04 04:57:06
【问题描述】:
在表格中,我有两个表格,例如 table#1、table#2。两个表都只发送一个 $_POST。如何获取数据表格,例如 table#1 ?是否可以在 $_POST ['table #1'] 中以某种方式进行选择?
<form id="prepForm" action="" method="POST">
<table id="1" class="table tabele-conclusions table-bordered">
<thead>
<tr>
<th>Lp.</th>
<th>desc</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">1</th>
<td><input name="row1_desc" value=""/></td>
</tr>
</tbody>
</table>
<table id="2" class="table tabele-conclusions table-bordered">
<thead>
<tr>
<th>Lp.</th>
<th>desc</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">2</th>
<td><input name="row2_desc" value=""/></td>
</tr>
</tbody>
</table>
【问题讨论】:
-
欢迎来到 StackOverflow。请通过tour 环顾四周,通读HELP center,然后阅读How to 、What types of questions should I avoid asking? 并提供MCVE : Minimal, Complete, and Verifiable Example。如果周围的人可以轻松阅读并理解您的意思或问题所在,他们将更愿意提供帮助:)
-
"两个表都只发送一个 $_POST" 如何通过 POST 发送表?你能详细说明一下吗?
-
将所有元素的
name属性定义为数组并像这样使用name = data[table1]['name'].... -
在您编辑之后,我建议您阅读一些关于数据提交和表单如何在 HTML 和 PHP 中工作的教程。
-
无需在此处定位您的“表”(因为它们在 $_POST 中不可用),您的输入字段都有名称,只需使用
$_POST['row1_desc']和$_POST['row2_desc']
标签: php