【发布时间】:2012-02-09 22:15:25
【问题描述】:
我有一个包含多行复选框的表单,每个复选框都有一个特定的 id,这些复选框使用foreach 循环显示。
你如何从类似的东西中获取$_POST 信息?我认为它在某种程度上就像$_POST[][],就像一个子数组,但我不知道如何设置它:
foreach($stakholderArray as $currentEntry) {
print "<tr class='$bgcolor'>";
print "<td class='left'>$currentEntry[org]</td>";
if($currentEntry['dataFound']) {
//if data was found for current stakeholder, display it
print ($currentEntry['Partner']) ? '<td><input type ="checkbox" checked ="checked" /></td>' : '<td><input type ="checkbox" /></td>';
print ($currentEntry['Agreement']) ? '<td><input type ="checkbox" checked ="checked" /></td>' : '<td><input type ="checkbox" /></td>';
print ($currentEntry['Train']) ? '<td><input type ="checkbox" checked ="checked" /></td>' : '<td><input type ="checkbox" /></td>';
print ($currentEntry['Meet']) ? '<td><input type ="checkbox" checked ="checked" /></td>' : '<td><input type ="checkbox" /></td>';
}
else { //else...no stakeholder data, display empty columns
print "<td><input type ='checkbox'/></td><td><input type ='checkbox'/></td><td><input type ='checkbox'/></td><td><input type ='checkbox'/></td><td><input type ='checkbox'/></td>";
print "</tr>";
}## Heading ##
【问题讨论】:
-
输入名称可以是变量数组吗?就像 我仍然无法让它工作..如果有帮助,这是一个截图plus.google.com/u/0/photos/102528100285286815171/albums/…
标签: php arrays foreach-loop-container