title: Duplication - php code duplicates row in MySQL - What is wrong?
body: <p>Hello community on stockoverflow!</p>
  
  <p>I am developing a form for collecting simple data within a table in my MySQL database.<br>
  I am fairly new at the php-language which means that i have mostly likely misunderstood or forgot something.</p>
  
  <p>I am having an issues with my php form code. It adds the same row twice within my MySQL database. Does anybody know what is wrong with the code?</p>
  
  <pre><code>add_shortcode('map_location_report','map_location_report_form');
  
  function map_location_report_form()
  {
      global $wpdb;
  
      $this_page  =   $_SERVER['REQUEST_URI'];
      $page       =   $_POST['page'];
  
      if ( $page == NULL )
      {
          echo '&lt;form method="post" action="' . $this_page .'"&gt;
  
                  &lt;div class="formfield-report" id="formfield-report-firstname"&gt;
                      &lt;label for="first_name" id="first_name"&gt;Navn: &lt;/label&gt;
                      &lt;input type="text" name="first_name" id="first_name" /&gt;
                  &lt;/div&gt;
  
                  &lt;div class="formfield-report" id="formfield-report-lastname"&gt;
                      &lt;label for="last_name" id="last_name"&gt;Efternavn: &lt;/label&gt;
                      &lt;input type="text" name="last_name" id="last_name" /&gt;
                  &lt;/div&gt;
  
                  &lt;div class="formfield-report" id="formfield-report-locationtype"&gt;
                      &lt;label for="report_type " id="report_type "&gt;Rapport type: &lt;/label&gt;
                      &lt;select name="report_type " /&gt;
                          &lt;option value="sigtmelding" selected&gt;Sigtmelding&lt;/option&gt;
                          &lt;option value="fangstrapport"&gt;Fangstrapport&lt;/option&gt;
                          &lt;option value="jagtomraade"&gt;Jagtområde&lt;/option&gt;
                      &lt;/select&gt;
                  &lt;/div&gt;
  
                  &lt;div class="formfield-report" id="formfield-report-latitude"&gt;
                      &lt;label for="location_latitude" id="location_latitude"&gt;Breddegrad: &lt;/label&gt;
                      &lt;input type="text" name="location_latitude" id="location_latitude" /&gt;
                  &lt;/div&gt;
  
                  &lt;div class="formfield-report" id="formfield-report-longitude"&gt;
                      &lt;label for="location_longitude" id="location_longitude"&gt;Længdegrad: &lt;/label&gt;
                      &lt;input type="text" name="location_longitude" id="location_longitude" /&gt;
                  &lt;/div&gt;
  
                  &lt;input type="hidden" value="1" name="page" /&gt;
  
                  &lt;div id="formfield-report-button"&gt;
                      &lt;input class="btn btn-default submit-form-button" type="Submit" /&gt;
                  &lt;/div&gt;
  
          &lt;/form&gt;';
      }
      elseif ( $page == 1 )
      {
          $first_name             =   $_POST['first_name'];
          $last_name              =   $_POST['last_name'];
          $report_type            =   $_POST['report_type '];
          $location_latitude      =   $_POST['location_latitude'];
          $location_longitude     =   $_POST['location_longitude'];       
  
          $page_one_table = 'maplocationreports';
  
          $page_one_inputs =  array
          (
              'first_name'            =&gt; $first_name,
              'last_name'             =&gt; $last_name,
              'report_type '          =&gt; $report_type ,
              'location_latitude'     =&gt; $location_latitude,
              'location_longitude'    =&gt; $location_longitude,
              'page'                  =&gt; $page
          );
  
          $insert_page_one = $wpdb-&gt;insert($page_one_table, $page_one_inputs);
  
          echo '&lt;h3&gt;Mange tak for dit bidrag!&lt;/h3&gt;';
          echo '&lt;p&gt;Der er sat stor pris på at du har taget dig tid til at registrere et punkt på kortet!&lt;/p&gt;';
  
      }
  };
  </code></pre>
  
  <p>CREATE TABLEmaplocationreports<code>(
     id INT( 7 ) NOT NULL AUTO_INCREMENT,
     first_name VARCHAR( 50 ) NOT NULL,
     last_name VARCHAR( 50 ) NOT NULL,
     report_type VARCHAR( 20 ) NOT NULL,
     location_latitude VARCHAR( 12 ) NOT NULL,
     location_longitude VARCHAR( 12 ) NOT NULL,
     page INT( 1 ) NOT NULL,
     timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
     PRIMARY KEY ( id )
  )</code></p>
  
  <p>Please let me know if you see any mistakes. I would much appreciate it!</p>
  
  <p>Thanks in advance!</p>