Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/77.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
用php读取表单元素_Php_Html - Fatal编程技术网

用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)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']