I would like to loop and retrieve values of multiple inputs of this form below for the best way, so how can i do, I have tried many times but unfortunately I did not succeed
here are the view code and controller code
<form action="../controller/Store/ExpensesUSD.php" method="POST">
<div class="input-wrapper">
<?php foreach($ExpensesUpdate AS $Expenses_Update): ?>
<select name="ProductServiceID[]">
<?php foreach ($expenses_registered AS $Expenses_Registered): ?>
<option value="<?php echo $Expenses_Registered->ExpenseID; ?>">
<?php echo $Expenses_Registered->ProductServiceName; ?>
</option>
<?php endforeach; ?>
</select>
<input type="number" name="TotalAmountUSD[]" id="TotalAmountUSD" placeholder="please enter an expense..." value="<?php echo $Expenses_Update->DeservedAmountUSD; ?>">
<input type="hidden" name="ID[]" value="<?php echo $debts_separate->ID; ?>" readonly>
<?php endforeach; ?>
</div> <!-- end input-wrapper -->
<button type="submit" name="submit" value="submit"
id="registerbtn">Enter</button>
</form>
$ID = (int)$_POST['ID'];
$ProductServiceID = $_POST['ProductServiceID'];
$TotalAmountUSD = $_POST['TotalAmountUSD'];
$PossibilityOFUpdating = 'No';
$UpdatingDeletingStatus = 'Updated';
$_POST['ID']returns an array.name. Your multiple form values are simply being posted as arrays, aren't they? What's the specific problem?