<form>
<input type="hidden" name="form_id" value="<?=$users['id']?>">
<table class="table text-center">
<thead class="text-uppercase">
<tr>
<th scope="col">Метро</th>
<th scope="col">Время</th>
<th scope="col">Номер</th>
<th scope="col">Опция</th>
</tr>
</thead>
<?php
$post = get_delivery_users();
?>
<?php foreach ($post as $users): ?>
<tbody>
<tr>
<th scope="row">1</th>
<td><select name="delivery_adress" class="form-control">
<? foreach(get_delivery_addresses() as $delivery_address): ?>
<option <?if ($delivery_address == $users['delivery_adress']) echo ' selected'?>><?=htmlspecialchars($delivery_address, ENT_QUOTES)?></option>
<? endforeach;?>
</select></td>
<td><input class="form-control" type="text" name="delivery_time" value="<?=htmlspecialchars($users['delivery_time'], ENT_QUOTES)?>" id="example-text-input"></td>
<td><input class="form-control" type="text" name="phone" value="<?=htmlspecialchars($users['phone'], ENT_QUOTES)?>" id="example-text-input"></td>
<td><select name="courier" class="form-control">
<? foreach(get_couriers() as $couriers): ?>
<option <?if ($couriers == $users['courier']) echo ' selected'?>><?=htmlspecialchars($couriers, ENT_QUOTES)?></option>
<? endforeach;?>
</select>
</td>
</tr>
</tbody>
<?php endforeach; ?>
</table>
<button type="submit" formmethod="post" name="couriers" formaction="courier.php" class="btn btn-xs btn-warning mb-3">Отправить</button>
</form>
<?php
require_once('db.php');
if(isset($_POST['couriers']))
{
$form_id = (int)$_POST['form_id'];
$phone = strip_tags(trim($_POST['phone']));
$delivery_adress = strip_tags(trim($_POST['delivery_adress']));
$courier = strip_tags(trim($_POST['courier']));
$SQL = "UPDATE Users SET phone='$phone', delivery_adress='$delivery_adress', courier='$courier' WHERE id='$form_id'";
$result = mysqli_query($link, $SQL);
if ($result) {
header('Location:delivery.php');
}
else {
printf("Ошибка: %s\n", mysqli_error($link));
}
}
?>
$names = ['Вася', 'Петя', 'Коля'];
foreach($names as $name):
echo '<input type="text" name="name" value="' . $name . '">';
end;
<input type="text" name="name" value="Вася">
<input type="text" name="name" value="Петя">
<input type="text" name="name" value="Коля">
$names = ['Вася', 'Петя', 'Коля'];
foreach($names as $key => $name):
echo '<input type="text" name="names[' . $key . ']" value="' . $name . '">';
end;
<input type="text" name="names[0]" value="Вася">
<input type="text" name="names[1]" value="Петя">
<input type="text" name="names[2]" value="Коля">