【发布时间】:2015-06-12 22:45:03
【问题描述】:
我想将我的帖子数组放入数组数组中。我有以下表单(此表单在 foreach 循环内),它将发布如下数组数据:
<input type="hidden" name="cl[]" value="">
<input type="hidden" name="cd[]" value="">
当在 firebug 中查看时,post 数组包含:
cl[] 4
cl[] 4
cd[] John
cd[] Shaw
我希望这些值合二为一,如下所示:
$allData = array(
array(
'cl' => 4,
'cd' => 'John',
),
array(
'cl' => 4,
'cd' => 'Shaw',
)
);
请帮忙。
【问题讨论】:
-
这些输入元素是如何呈现的?它们是动态的吗? (添加新行按钮)或者这个结构是静态的? (html 表单是硬编码的)