title: Prevent user from refreshing page to add blank value in php/sql
body: <p>config.php is the global file which has the connection codes.</p>
  
  <p>my UPDATED Insert.php code is:</p>
  
  <pre><code>&lt;?php
  
  include("config.php");
  
  if (isset($_POST[firstname]) &amp;&amp; isset($_POST[lastname]) &amp;&amp; isset($_POST[age])) {
      $sql = "INSERT INTO Persons (FirstName, LastName, Age) VALUES ('$_POST[firstname]','$_POST[lastname]','$_POST[age]')";
      mysql_query($sql, $connect); 
      header("Location: add.htm");
      // "1 record added";
  }
  
  else {
      echo "No record added";
      echo "&lt;meta http-equiv=\"refresh\" content=\"5;url=add.htm\"/&gt;";
  }
  
  if (!mysql_query($sql,$connect))
    {
    die('Error: ' . mysql_error());
    }
  
  mysql_close($connect);
  ?&gt;
  </code></pre>
  
  <p>my View.php code is:</p>
  
  <pre><code>&lt;?php
  include("config.php");
  
  $sql = mysql_query("SELECT * FROM Persons");
  while($results = mysql_fetch_array($sql)) {
      echo $results['FirstName'] . ', ' . $results['LastName'] . ', ' . $results['Age'] . '&lt;br/&gt;';
  }
  
  if (!mysql_query($sql,$connect))
  {
    die('Error: ' . mysql_error());
  }
  
  mysql_close($connect);
  ?&gt;
  </code></pre>
  
  <p>my Config.php code is:</p>
  
  <pre><code>&lt;?php
  
  $dbhost="MYWEBHOST";
  $dbusername="MYUSERNAME";
  $dbpassword="MYPASSWORD";
  $dbname="MYDATABASE";
  
  $connect = mysqli_connect($dbhost, $dbusername, $dbpassword);
  mysql_select_db($dbname,$connect) or die ("Could not connect to database");
  
  ?&gt;
  </code></pre>
  
  <p>Insert.php display the message "1 record added" and redirect the user back to the html form. Which is working fine but I do not want to add duplicate/blank values when the user to either refresh or come directly to Insert.php. How do I accomplish this in the existing Insert.php code?</p>