Form Submission to Database and Redirect in PHP

Suppose we have a form:

form.php<form method="POST">
  <input name="test1">
  <input name="test2">
  <input type="submit">
</form>

Let's save this form's data to the database:

form.php<?php
  if (!empty($_POST)) {
    // save to database
  }
?>

However, there is a problem here: if you refresh the browser page, the form will be submitted and saved again, creating a duplicate data entry.

To solve this problem, you need to perform a redirect to the same page after saving the form:

php<?php
  if (!empty($_POST)) {
    // save to database
    
    header('Location: form.php');
    die();
  }
?>
Задание 1

Create a form and implement its saving to the database after submission. Eliminate double saving after submission.