<?php
if (isset($_GET['edit_id'])) {
$query = "SELECT * FROM workers WHERE id = $_GET[edit_id]";
mysqli_query($link, $query) or die(mysqli_error($link));
$result = mysqli_query($link, $query) or die(mysqli_error($link));
for ($data = []; $row = mysqli_fetch_assoc($result); $data[] = $row);
foreach ($data as $edit) {
echo "<form action=\"\" method=\"GET\">";
echo "<input type=\"text\" name=\"edit_name\" value=\" $edit[name]\"><br>";
echo "<input type=\"text\" name=\"edit_age\" value=\" $edit[age]\"><br>";
echo "<input type=\"text\" name=\"edit_salary\" value=\" $edit[salary]\"><br>";
echo "<input type=\"submit\" name=\"submit\"";
echo "</form>";
}
} if (isset($_GET['submit'])) {
$editName = $_GET['edit_name'];
$editAge = $_GET['edit_age'];
$editSalary = $_GET['edit_salary'];
$query = "UPDATE workers SET name = '$editName', salary = $editSalary, age = $editAge WHERE id = '$edit_id'";
mysqli_query($link, $query) or die(mysqli_error($link));
}
var_dump($_GET['submit']);
?>