用php读取表单元素
我有一个表单,其中包含一些类似这样的输入 每行的用php读取表单元素,php,html,Php,Html,我有一个表单,其中包含一些类似这样的输入 每行的代码为: <tr id="1"> <td><input id="dp1407131141368" size="18" value="02/03/1393 00:00:01" class="datepicker hasDatepicker" name="starttime[]" type="text"></td> <td><input id="dp1407131141369" siz
代码为:
<tr id="1">
<td><input id="dp1407131141368" size="18" value="02/03/1393 00:00:01" class="datepicker hasDatepicker" name="starttime[]" type="text"></td>
<td><input id="dp1407131141369" size="18" value="02/03/1393 00:30:00" class="datepicker hasDatepicker" name="endtime[]" type="text"></td>
<td><p id="t1">title 1</p><input value="new title" name="title[]" id="ht1" type="hidden"></td>
<td><p id="e1">comment 1</p><input value="new comment" name="extended[]" id="he1" type="hidden"></td>
<td><p id="s1">short comment</p><input value="new short comment" name="short[]" id="hs1" type="hidden"></td>
<td><input value="+" style="background-color: green;font-weight: bold;color:white" class="additem" type="button"> <input style="background-color: red;font-weight: bold;color:white" value="X" class="removeitem" type="button"></td>
</tr>
如何解决此问题?数组在值之前使用键 使用$array[key][value],如下所示:
$_POST[$key]['title']
谢谢,但我得到了这个错误:
注意:未定义的偏移量:在第264行的C:\xampp\htdocs\epg\upload.php中为1,我的回音为--
两次尝试变量转储($\u POST)当我使用jquery添加行,然后查看页面的源代码时,会看到源代码中未显示的新行。我认为由于这个问题,我的元素在foreach中没有显示
if (isset($_POST['submit']))
{
foreach ($_POST['starttime'] as $key => $val) {
echo $_POST['title'][$key] . ' - ' . $_POST['short'][$key] . ' - ' . $_POST['starttime'][$key] . ' - ' . $_POST['endtime'][$key] . "</br>";
}
}
$_POST[$key]['title']