以下是一個形式的HTML:
<form action="add_rebate_by_product.php" role="form" method="post">
<input type="hidden" class="form-control" name="form_submitted" id="form_submitted" value="yes">
<input type="hidden" class="form-control" name="company_id" id="company_id" value="46">
<input type="text" class="form-control" name="products[1]" id="products[1]" value="9">
<input type="text" class="form-control" name="products[2]" id="products[2]" value="11">
<input type="text" class="form-control" name="pack[1]" id="pack[1]" value="10">
<input type="text" class="form-control" name="quantity[1]" id="quantity[1]" value="20">
<input type="text" class="form-control" name="volume[1]" id="volume[1]" value="30">
<input type="text" class="form-control" name="units[1]" id="units[1]" value="7">
<input type="text" class="form-control" name="amount[1]" id="amount[1]" value="40">
<input type="text" class="form-control" name="rebate_start_date[1]" id="rebate_start_date[1]" value="2014-05-01">
<input type="text" class="form-control" name="rebate_expiry_date[1]" id="rebate_expiry_date[1]" value="2014-05-15">
<input type="text" class="form-control" name="applicable_states[0]" id="applicable_states[0]" value="1">
<input type="text" class="form-control" name="applicable_states[1]" id="applicable_states[1]" value="7">
<input type="text" class="form-control" name="applicable_states[2]" id="applicable_states[2]" value="11">
<input type="text" class="form-control" name="rebate_total_count[1]" id="rebate_total_count[1]" value="5000">
<input type="text" class="form-control" name="products[1]" id="products[1]" value="10">
<input type="text" class="form-control" name="products[2]" id="products[2]" value="8">
<input type="text" class="form-control" name="pack[2]" id="pack[2]" value="100">
<input type="text" class="form-control" name="quantity[2]" id="quantity[2]" value="200">
<input type="text" class="form-control" name="volume[2]" id="volume[2]" value="300">
<input type="text" class="form-control" name="units[2]" id="units[2]" value="10">
<input type="text" class="form-control" name="amount[2]" id="amount[2]" value="400">
<input type="text" class="form-control" name="rebate_start_date[2]" id="rebate_start_date[2]" value="2014-05-16">
<input type="text" class="form-control" name="rebate_expiry_date[2]" id="rebate_expiry_date[2]" value="2014-05-31">
<input type="text" class="form-control" name="applicable_states[0]" id="applicable_states[0]" value="31">
<input type="text" class="form-control" name="applicable_states[1]" id="applicable_states[1]" value="44">
<input type="text" class="form-control" name="applicable_states[2]" id="applicable_states[2]" value="48">
<input type="text" class="form-control" name="applicable_states[3]" id="applicable_states[3]" value="49">
<input type="text" class="form-control" name="applicable_states[4]" id="applicable_states[4]" value="50">
<input type="text" class="form-control" name="rebate_total_count[2]" id="rebate_total_count[2]" value="9000">
<button type="submit" class="btn btn-default">Go Back</button>
</form>
提交這種形式我得到以下陣列$_POST
這是不對的,不顯示在表格中的所有值之後。爲什麼?我在命名字段時存在任何錯誤?
Array
(
[form_submitted] => yes
[company_id] => 46
[products] => Array
(
[1] => 10
[2] => 8
)
[pack] => Array
(
[1] => 10
[2] => 100
)
[quantity] => Array
(
[1] => 20
[2] => 200
)
[volume] => Array
(
[1] => 30
[2] => 300
)
[units] => Array
(
[1] => 7
[2] => 10
)
[amount] => Array
(
[1] => 40
[2] => 400
)
[rebate_start_date] => Array
(
[1] => 2014-05-01
[2] => 2014-05-16
)
[rebate_expiry_date] => Array
(
[1] => 2014-05-15
[2] => 2014-05-31
)
[applicable_states] => Array
(
[0] => 31
[1] => 44
[2] => 48
[3] => 49
[4] => 50
)
[rebate_total_count] => Array
(
[1] => 5000
[2] => 9000
)
)
到底是下面的陣列中丟失了怎麼辦?對不起,但是一見鍾情就有點多了。請提供更詳細的信息和更少的無用信息。 –
缺少什麼值? –
你有一些相互衝突的名字,例如'applicable_states [0]'。 – Marty