User gets registered every time I refresh the page after submitting form : <p>I'm working on registration process with PHP. I managed to get submitted form data and save it into mysql table, but the problem is, if I refresh the page, user gets registered again. This is my PHP code which I have included in a div tag with other content:</p>

<pre><code>&lt;?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"]);
    }
  ?&gt;
</code></pre>

<p>I've also tried to unset the <code>$_POST["registration"]</code> as you can see, but it did not help. What should I do, to make this code work only when the "register" button is clicked?</p>

<p>P.S. I'm starting session in the beginning of the page, but not assigning any data to it.</p>
