提交表单后每次刷新页面时用户都会注册

User gets registered every time I refresh the page after submitting form

我正在处理 PHP 的注册流程。我设法获取提交的表单数据并将其保存到 mysql table,但问题是,如果我刷新页面,用户将再次注册。这是我的 PHP 代码,我已将其包含在带有其他内容的 div 标签中:

<?php
    if(isset($_POST["registration"])){
            $con = mysqli_connect("localhost", "user", "pass", "name") or die("connection error");
      if (mysqli_connect_errno()){
        echo "Failed to connect to MySQL: " . mysqli_connect_error();
      }

      $name = $_POST["name"];
      $lname = $_POST["lname"];
      $email = $_POST["email"];
      $pass = $_POST["pass"];
      $company = $_POST["company"];
      $webpage = $_POST["webpage"];
      $phone = $_POST["phone"];
      $country = $_POST["country"];
      $city = $_POST["city"];
      date_default_timezone_set('Asia/Tbilisi');
      $info = getdate();
      $date = $info['mday'];
      $month = $info['mon'];
      $year = $info['year'];
      $hour = $info['hours'];
      $min = $info['minutes'];
      $sec = $info['seconds'];
      $reg_date = $year . "-" . $month . "-" . $date . " " . $hour . ":" . $min . ":" . $sec;
      $confirmed = "0";
      $success = mysqli_query($con, "INSERT INTO users(firstname, lastname, email, pass, company, webpage, country, city, phone, reg_date, confirmed) VALUES('$name','$lname','$email', '$pass', '$company', '$webpage', '$country', '$city', '$phone', '$reg_date', '$confirmed')");
      if($success){
            echo "You have been successfully registered. Use the form above to log in.";
        }
        else{
            echo "registration error";
        }
      //unset($_POST["registration"]);
    }
  ?>

如您所见,我也尝试取消设置 $_POST["registration"],但没有帮助。我应该怎么做才能使此代码仅在单击 "register" 按钮时起作用?

P.S。我在页面的开头开始会话,但没有向它分配任何数据。

成功后将用户重定向到另一个 url

header('Location: '. $url);
die();