'Get info from a Multidimensional Form
<td><input type="checkbox" class="flipswitch" id="billing" name="billing[]" value="<?php echo $x['Account'] ?>"></td>
<td class="no-print"><input type="text" class="boxcustwhite" size="5" name="order[]" value="<?php echo $x['Order']?>"></td>
<td><input type="text" class="boxcustwhite" size="6" name="account[]" value="<?php echo $x['Account']?>"></td>
<td><input type="text" class="boxcustwhite" size="8" name="meter[]" value="<?php echo $x['Meter']?>"></td>
<td><input type="text" class="boxcustwhiteleft" size="20" name="name[]" value="<?php echo $x['Name']?>"></td>
<td><?php echo number_format($x['LastInventory'], "0", "", ",") ?></td>
<td><input type="number" class="boxcustwhite" size="8" name="curinv[]" min="<?php echo $x['LastInventory'] ?>"
I am trying to get the values for billing[], account[] and curinv[] on submit in a form. The billing is a checkbox and I can get just the ones checked to show in my form submit with the below code (using the var_dump($billing). But the remaining items do not associate with the correct billing checkbox.
if(isset($_POST['create'])){
$billing = $_POST['billing'];
var_dump($billing);
for ($i = 0; $i < count($billing); ++$i){
$account = $_POST['billing'][$i];
$quantity = $_POST['quantity'][$i];
$inv = $_POST['curinv'][$i];
What am I doing wrong?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
