в адресной строке,id записи которая подвергается редактированию(правильное),в поле id =1 (неправильно)
if (isset($_GET['id'])) {
if (!empty($_POST)) {
$id = isset($_POST['id']) && !empty($_POST['id']) && $_POST['id'] != 'auto' ? $_POST['id'] : NULL;
$surname = isset($_POST['surname']) ? $_POST['surname'] : '';
$name = isset($_POST['name']) ? $_POST['name'] : '';
$patron = isset($_POST['patron']) ? $_POST['patron'] : '';
$serie = isset($_POST['serie']) ? $_POST['serie'] : '';
$number = isset($_POST['number']) ? $_POST['number'] : '';
$propiska = isset($_POST['propiska']) ? $_POST['propiska'] : '';
$telephone = isset($_POST['telephone']) ? $_POST['telephone'] : '';
$ls = isset($_POST['ls']) ? $_POST['ls']:'';
$balance = isset($_POST['balance']) ? $_POST['balance'] : '';
$date = isset($_POST['date']) ? $_POST['date'] : '';
// Update the record
/*CLIENT*/
$stmt = $pdo->prepare('UPDATE Client SET surname = ?, name = ?, patron = ?, serie = ?, number = ?, propiska=?,telephone=? WHERE id = ?');
$stmt->execute([$surname, $name, $patron, $serie, $number,$propiska,$telephone, $_GET['id']]);
/*BANK*/
$stmt = $pdo->prepare('UPDATE bank SET ls = ?, balance = ? WHERE id = ?');
$stmt->execute([$ls,$balance, $_GET['id']]);
header('Location:/read.php');
}
// Get contact from table
$stmt = $pdo->prepare('SELECT * FROM Client,bank WHERE Client.id = ?');
$stmt->execute([$_GET['id']]);
$contact = $stmt->fetch(PDO::FETCH_ASSOC);
if (!$contact) {
exit('Контакт не найден!');
}
} else {
exit('Контакт не найден!');
}
?>
<?=template_header('Редактирование')?>
<div class="content update">
<h2>Обновление записи #<?=$contact['id']?></h2>
<form action="update.php?id=<?=$contact['id']?>" method="post">
<label for="surname">id</label>
<input type="text" name="id" placeholder="id" value="<?=$contact['id']?>" id="id">
<label for="surname">Фамилия</label>
<input type="text" name="surname" placeholder="Фамилия" value="<?=$contact['surname']?>" id="surname">
<label for="name">Имя</label>
<input type="text" name="name" placeholder="Имя" value="<?=$contact['name']?>" id="name">
<label for="patron">Отчество</label>