<div class="container" style="margin-top: 10px;">
<div class="text-center">
<h4>Нормы положенности: <?php echo $_SESSION['person']['nameovdrb'] ?></h4>
</div>
</div>
<div class="container-fluid" style="margin-top: 20px;">
<?php if (!empty($resselect)) {
foreach ($resselect as $ressub) { ?>
<form action="" method="POST">
<table id="table-info" class="table table-sm table-bordered" style="font-size: 12px;">
<thead class="bg-primary text-white text-center">
<tr>
<th colspan=9><?php echo $ressub->name_subdivision; ?></th>
</tr>
</thead>
<tbody class="table-light text-center">
<tr>
<?php if (!empty($resselecttech)) {
foreach ($resselecttech as $restech) { ?>
<td><?php echo $restech->type; ?></td>
<?php
} ?>
<?php } else { ?>
<tr>
<td colspan=9>В БАЗЕ ДАННЫХ НЕТ ЗАПИСЕЙ</td>
</tr>
<?php } ?>
</tr>
<tr>
<?php if (!empty($resselecttech)) {
foreach ($resselecttech as $restech) { ?>
<td><input required type="text"><span>единиц техники</span></td>
<?php
} ?>
<?php } else { ?>
<tr>
<td colspan=9>В БАЗЕ ДАННЫХ НЕТ ЗАПИСЕЙ</td>
</tr>
<?php } ?>
</tr>
<tr>
<td colspan=9><button class="btn btn-success btn-sm">Сохранить</button></td>
</tr>
</tbody>
</table>
</form>
<?php
}?>
<?php } else { ?>
<tr>
<td colspan=9>В БАЗЕ ДАННЫХ НЕТ ЗАПИСЕЙ</td>
</tr>
<?php } ?>
</div>
Как мне передавать данные из форм, которые выведены циклом ?
<input type="hidden" name="sub_id" value="ТУТ ID подразделения" />
<input required type="text">
где прописывается количество единиц техники, нужно тоже как-то клеймить <form name="form1" method="post" action="/save/1"></form>
<form name="form2" method="post" action="/save/2"></form>
<form name="form3" method="post" action="/save/3"></form>
<table>
<tbody>
<tr>
<td><input type="text" name="param1" form="form1"></td>
<td><input type="text" name="param2" form="form1"></td>
<tr>
<tr><td><button type="submit" form="form1">Send</button></td><tr>
</tbody>
<tbody>
<tr>
<td><input type="text" name="param1" form="form2"></td>
<td><input type="text" name="param2" form="form2"></td>
<tr>
<tr><td><button type="submit" form="form2">Send</button></td><tr>
</tbody>
<tbody>
<tr>
<td><input type="text" name="param1" form="form3"></td>
<td><input type="text" name="param2" form="form3"></td>
<tr>
<tr><td><button type="submit" form="form3">Send</button></td><tr>
<table>
<form method="post" action="/save">
<table>
<tr>
<td><input type="text" name="data[ОУР][param1]"></td>
<td><input type="text" name="data[ОУР][param2]"></td>
<tr>
<tr>
<td><input type="text" name="data[ОЭБ][param1]"></td>
<td><input type="text" name="data[ОЭБ][param1]"></td>
<tr>
<tr>
<td><input type="text" name="data[ОНК][param1]"></td>
<td><input type="text" name="data[ОНК][param1]"></td>
<tr>
<tr><td><button type="submit">Send</button></td><tr>
</tbody>
<table>
</form>
<?php
foreach ($resselecttech as $restech) { ?>
<td><input required type="text" name="values[<?php echo $ressub->name_subdivision; ?>][<?php echo $restech->type;?>]"><span>единиц техники</span></td>
<?php
} ?>
$_POST['values']
такой структуры:[
'ОУР' => [
'ИБП' => 5, // где 5 это значение из инпута
'КМТ А3' => ...,
...
],
'ОЭБ и ПК' => [
'ИБП' => ...,
'КМТ А3' => ...,
...
],
...
]