【发布时间】:2022-01-08 18:01:10
【问题描述】:
我需要从数组中获取值。
我的代码:
$tags = $array['bePVM'][''];
echo ('<form action="" method="POST">');
for($o = 0; $o<$i; $o++){
echo "<br>Užsakymo: <b> ",$data2DArray[$o][0], "</b> Price witout VAT: ",'<input type="text" name="bePVM[]" value="">'," VAT: ",'<input type="text" name="PVM[]" value="">'," Price with VAT: ",'<input type="text" name="suPVM[]" value="">',"<br>";
}
echo ('<input type="submit" value="">');
echo ('</form>');
print_r($_POST);
echo $tags[1];
我有这个输出:
Warning: Trying to access array offset on value of type null
Array ( [bePVM] => Array ( [0] => 100
[1] => 200 )
[PVM] => Array ( [0] => 21
[1] => 42 )
[suPVM] => Array ( [0] => 121
[1] => 242 )
)
我如何回显 [bePVM][1] 哪里是 200?
谢谢
【问题讨论】:
-
你已经声明了标签
$tags = $array['bePVM'][''];并且你正在打印echo $tags[1];,这将显示array offset on value of type null
标签: php multidimensional-array