title: how to stop data automatically insert into database in php
body: <p>I have problem in this code.
  In this code when i press save data button , the data insert into database but when i refresh page then it's automatically insert into database, what should i do in my code then stop automatically insert data into database, thanks in advance</p>
  
  <pre><code>&lt;?php 
  require './database/databaseConnection.php';
  
  if(isset($_POST['save_button']))
      {   
      if(($_POST['fname']&amp;&amp;($_POST['lname'])))
          {
          $first_name=$_POST['fname'];
          $last_name=$_POST['lname'];
          $qry="INSERT INTO user_master(first_name,last_name) values('$first_name','$last_name')";
          $result=  mysql_query($qry)or die(mysql_error());
          if($result){           
              echo 'SuccessFully saved data';            
          }
          else{   
              echo 'Data Not Inserted!';            
          }       
          }   
      }
  ?&gt;
  
  &lt;!DOCTYPE html&gt;
  &lt;html&gt;
      &lt;head&gt;
          &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;
          &lt;title&gt;&lt;/title&gt;
          &lt;link rel="stylesheet" href="bootStrap/css/bootstrap.min.css"&gt;
                  &lt;link rel="stylesheet" href="bootStrap/css/bootstrap.css"&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;div class="container jumbotron "&gt;
  
              &lt;form action="" method="post"&gt;
               &lt;table class="table-responsive"&gt;
              &lt;div class="form-group form-inline"&gt;
  
                      &lt;tbody&gt; 
                      &lt;tr&gt;
                 &lt;td&gt; &lt;label for="fname" class="label-info"&gt;First Name&lt;/label&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;input class="form-control" type="text" name="fname"&gt;&lt;/td&gt;
  
                  &lt;td&gt;&lt;label for="lname" class="label-info"&gt;Last Name&lt;/label&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;input class="form-control" type="text" name="lname"&gt;&lt;/td&gt;
  
                  &lt;/tr&gt;       
                      &lt;/tbody&gt;
  
              &lt;/div&gt;     
               &lt;/table&gt;             
                  &lt;button type="submit" name="save_button" class="btn-success" &gt;Save Data&lt;/button&gt;   
     &lt;/form&gt;            
  
          &lt;/div&gt;
  
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>