发送多个具有相同名称的输入值后

时间:2019-02-21 09:59:10

标签: php html arrays

我正在尝试将一些输入字段发送到我的PHP文件并在其中循环,因此我需要将它们作为数组。

这些是我的输入字段:

<input type="hidden" name="productencheckout[3314,99|1 pallet][kuub]" value="1 pallet">
<input type="hidden" name="productencheckout[3314,99|1 pallet][price]" value="31499">
<input type="hidden" name="productencheckout[3314,99|1 pallet][quantity]" value="1">
<input type="hidden" name="productencheckout[2][price]" value="27999">
<input type="hidden" name="productencheckout[2][quantity]" value="1">
<input type="hidden" name="productencheckout[70][price]" value="30999">
<input type="hidden" name="productencheckout[70][quantity]" value="1">
<input type="hidden" name="productencheckout[3624,99|2 pallets][kuub]" value="2 pallets">
<input type="hidden" name="productencheckout[3624,99|2 pallets][price]" value="62499">
<input type="hidden" name="productencheckout[3624,99|2 pallets][quantity]" value="1">

它像这样发布:

productencheckout[3314,99|1 pallet][kuub]: 1 pallet
productencheckout[3314,99|1 pallet][price]: 31499
productencheckout[3314,99|1 pallet][quantity]: 1
productencheckout[2][price]: 27999
productencheckout[2][quantity]: 1
productencheckout[70][price]: 30999
productencheckout[70][quantity]: 1
productencheckout[3624,99|2 pallets][kuub]: 2 pallets
productencheckout[3624,99|2 pallets][price]: 62499
productencheckout[3624,99|2 pallets][quantity]: 1

所以我尝试了以下操作:

echo $_POST['productencheckout']['3314,99|1 pallet']['kuub'];

$productarr = $_POST['productencheckout'];

echo '<pre>';
print_r($productarr);
echo '</pre>';

但是这都是空的。为什么?

0 个答案:

没有答案