发布数组后,我能够print_r显示整个数组,但我无法回显单个值。我需要获取这些单个值,以便我可以将它们放在文本项的值标记中。目前,每次发布页面时,这些值都会消失,因为我找不到如何获取相应的值。
当我print_r($ subs)时,我得到了正确的值 -
Array
(
[0] => Array
(
['subs_name'] => Image PC and load programs
['subs_target'] => 03/10/2015
['subs_owner'] => 1
)
[1] => Array
(
['subs_name'] => Update Inventory
['subs_target'] => 03/17/2015
['subs_owner'] => 1
)
[2] => Array
(
['subs_name'] => Deploy PC
['subs_target'] => 03/24/2015
['subs_owner'] => 1
)
[3] => Array
(
['subs_name'] => Follow up with user
['subs_target'] => 03/31/2015
['subs_owner'] => 1
)
)
如果我试图回复$ subs [0] [' subs_target']我没有得到任何回报。我确定我做了一些愚蠢的事,但我无法确定那是什么。我扫描了几篇文章并找不到解决方案。
这是我用来设置数组的表单输入 -
while ($row = $stmt->fetch()) {
echo " <tr>\n";
echo " <td>\n";
echo "<input type=\"hidden\" name=\"subs[$count]['subs_name']\" class=\"none\" value=\"" . $row['prosub_name'] . "\">";
echo "<p>" . $row['prosub_name'] . "</p>";
echo "</td>\n";
echo " <td align=\"center\">\n";
echo " <input type=\"text\" class=\"datepicker\" name=\"subs[$count]['subs_target']\" value=\"" . $subs["$count"]['subs_target'] . "\">\n";
echo "</td>\n";
echo " <td align=\"center\">\n";
echo " <select name=\"subs[$count]['subs_owner']\" class=\"diedit\">\n";
getUserDD($hid_owner, 'acc_tix_pro');
echo " </select>\n";
echo " </td>\n";
echo " </tr>\n";
$count++;
}
答案 0 :(得分:0)
尝试使用echo检查值,但使用var_dump:
var_dump($subs[0]['subs_target']);