php - Data saved twice in MySQL database. Don't know what I do wrong? -


i working on feature on website. implemented interactive map using osm , leaflet , users add location reports map.

although, first issue ran when users adding location report data being send websites mysql database registered twice should not.

i kindly ask take @ code , search thing duplicate data.

function map_location_report_form() {      if( current_user_can( 'create_users' ))      {          global $wpdb;          $this_page  =   $_server['request_uri'];         $page       =   $_post['page'];          if ( $page == null )          {             echo '<form method="post" action="' . $this_page .'">                      <div class="formfield-report" id="formfield-report-firstname">                         <label for="first_name" id="first_name">navn: </label>                         <input type="text" name="first_name" id="first_name" />                     </div>                      <div class="formfield-report" id="formfield-report-lastname">                         <label for="last_name" id="last_name">efternavn: </label>                         <input type="text" name="last_name" id="last_name" />                     </div>                      <div class="formfield-report" id="formfield-report-locationtype">                         <label for="location_type" id="location_type">rapport type: </label>                         <select name="location_type" />                             <option value="sigtmelding" selected>sigtmelding</option>                             <option value="fangstrapport">fangstrapport</option>                             <option value="jagtomraade">jagtområde</option>                         </select>                     </div>                      <div class="formfield-report" id="formfield-report-latitude">                         <label for="location_latitude" id="location_latitude">breddegrad: </label>                         <input type="text" name="location_latitude" id="location_latitude" />                     </div>                      <div class="formfield-report" id="formfield-report-longitude">                         <label for="location_longitude" id="location_longitude">længdegrad: </label>                         <input type="text" name="location_longitude" id="location_longitude" />                     </div>                      <input type="hidden" value="1" name="page" />                      <div id="formfield-report-button">                         <input class="btn btn-default submit-form-button" type="submit" />                     </div>              </form>';                        }         elseif ( $page == 1 )          {             $first_name             =   $_post['first_name'];             $last_name              =   $_post['last_name'];                 $location_type          =   $_post['location_type'];             $location_latitude      =   $_post['location_latitude'];             $location_longitude     =   $_post['location_longitude'];              $page_one_inputs =  array             (                 'first_name'            => $first_name,                 'last_name'             => $last_name,                 'location_type'         => $location_type,                 'location_latitude'     => $location_latitude,                 'location_longitude'    => $location_longitude,                 'page'                  => $page             );              $page_one_table = 'maplocationreports';              $insert_page_one = $wpdb->insert($page_one_table, $page_one_inputs);              echo '<h3>mange tak dit bidrag!</h3>';             echo '<p>der er sat stor pris på @ du har taget dig tid til @ registrere et punkt på kortet!</p>';         }      }     else      {         echo    '<p>desværre er denne service under udvikling.</p>                  <p>mange tak din interesse.</p>';     }    };  add_shortcode('map_location_report','map_location_report_form'); 

let me know if more information necessary understand going on.

thank in advance.

best regards,

kim

check database schema, can cause of wrong database schema incorrect primary key/foreign key or field missing.


Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

order - Notification for user in user account opencart -