So I've been tasked with crawling through a smallish PHP application to fix bugs and improve things where I can. One thing I noticed was that updates were not updates, they were deletes+inserts, so I'm doing what I can to remedy that.
To that end, I've added a hidden element to each row of a large table of items which will contain the id of said item so that I know what to update. Problem is that it isn't getting set in the items array in $_POST
, and I haven't any clue why.
As an example, here's a row in HTML:
<div class="row">
<div class="c item_index"><sub>1</sub></div>
<input type="hidden" name="ordered_items[1][id]" id="item_id1" value="9" disabled="">
<div class="c qty">
<input type="text" name="ordered_items[1][quantity]" id="quantity1" value="12">
</div>
<div class="c vendor_num">
<input type="text" name="ordered_items[1][vendor_number]" id="vendor_num1" value="">
</div>
<div class="c item_desc">
<input type="text" name="ordered_items[1][description]" id="desc1" value="12">
</div>
<div class="c cost_per">
<input type="text" name="ordered_items[1][cost_per]" id="cost1" value="12.00">
</div>
<div class="c total">
<input type="text" name="ordered_items[1][total]" class="total" placeholder="0.00"
id="total1" value="144.00" readonly="">
</div>
</div>
Here's it's entry in $_POST
:
[ordered_items] => Array
(
[1] => Array
(
[quantity] => 12
[vendor_number] =>
[description] => 12
[cost_per] => 12.00
[total] => 144.00
)
)
I appreciate any and all suggestions!