title: Unable to send data from Form to SQL database
body: <p>So Ive this code which accepts input from user into a form and updates the SQL database when submit is clicked (without refreshing the page). 
  <strong>The problem is that it isnt updating/sending the values to sql table.</strong></p>
  
  <p>I've tried to follow examples and tutorials I've found on several sites, but I can't get any of them to work.</p>
  
  <p>I have the form(index.html) and the php file(upd.php) for db connection and update . The code for it is below. </p>
  
  <p>I'm trying to save these values to the database
     table named <code>messages</code>:-</p>
  
  <ul>
  <li>timestamp(tstamp) : <strong>Is a dynamic value, which is the timestamp of the video file being played in the browser( for example 1.935771)</strong>,</li>
  <li>message(any comments)   </li>
  <li>checkbox values</li>
  </ul>
  
  <p>index.html</p>
  
  <pre><code>&lt;body&gt;
    &lt;h1&gt;VIDO LABELLING TOOL&lt;/h1&gt;
  
    &lt;video id="my_video_1" class="video-js vjs-default-skin" controls preload="auto" width="640" height="268"
    data-setup='{ "playbackRates": [0.5, 1, 1.5, 2, 4] }'&gt;
      &lt;source src="project.m4v" type='video/mp4'&gt;
      &lt;track src='br.srt' kind="subtitles" srclang="en" label="English" default&gt;
    &lt;/video&gt;
  
  
  
  &lt;script&gt;
  // Get the audio element with id="my_video_1"
  var aud = document.getElementById("my_video_1");
  
  // Assign an ontimeupdate event to the audio element, and execute a function if the current playback position has changed
  aud.ontimeupdate = function() {myFunction()};
  
  
  &lt;/script&gt; 
  
  
  &lt;div class="container" style="max-width:800px;margin:0 auto;margin-top:50px;"&gt;
      &lt;form name="contact-form" action="" method="post" id="contact-form"&gt;
          &lt;label for="email"&gt;Comments about the frame&lt;/label&gt;
          &lt;textarea name="message" class="form-control" id="message"&gt;&lt;/textarea&gt;
  
          &lt;div class="error" id="error_message"&gt;&lt;/div&gt;
  
          &lt;label&gt;Vehicle Type:&lt;/label&gt;
          &lt;input name="veh_type_1"  id="veh_type_1" type="checkbox" value="lmv"&gt;lmv
          &lt;input  name="veh_type_2" id="veh_type_2" type="checkbox" value="2w"&gt;2w
          &lt;p&gt;TimeStamp: &lt;span id="tstamp"&gt;&lt;/span&gt;&lt;/p&gt;
    &lt;/div&gt;
    &lt;p class="submit"&gt;
      &lt;button type="submit" class="btn btn-primary" name="submit" value="Submit" id="submit_form"&gt;Submit&lt;/button&gt;
    &lt;/p&gt;
  
     &lt;div class="display-content"&gt;
      &lt;div class="message-wrap dn"&gt;  &lt;/div&gt;
     &lt;/div&gt;
     &lt;/form&gt;
  &lt;/div&gt;
  
  
  &lt;script&gt;
      function myFunction() {
          document.getElementById("tstamp").innerHTML = aud.currentTime;
      }
  &lt;/script&gt;
  
  
  &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript"&gt;
      $(function() {
          $("#contact-form").on("submit",function(e) {
              e.preventDefault();
              $.ajax({
                  type: 'post',
                  url: "insert.php",
                  data: $( this ).serialize(),
                  success: function() {
                      alert("form was submitted");
                  }
              });
              return false;
          });
      });
  &lt;/script&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>The php file as follows:-</p>
  
  <pre><code>&lt;?php
  $servername = "localhost";
  $database = "test";
  $username = "root";
  $password = "";
  
  // Create connection
  
  $conn = mysqli_connect($servername, $username, $password, $database);
  
  // Check connection
  
  if (!$conn) {
        die("Connection failed: " . mysqli_connect_error());
  }
  
  echo "Connected successfully";
  
  
  if(isset($_POST['Submit'])) {
      $tstamp=addslashes($_POST['tstamp']);
      $message=addslashes($_POST['message']);
      $veh_type_1=addslashes($_POST['veh_type_1']);
      $veh_type_2=addslashes($_POST['veh_type_2']);
  
  
      mysqli_query($conn, "insert into messages(message,tstamp,veh_type_1, veh_type_2) values ('$message','$tstamp','$veh_type_1', '$veh_type_2')");
      $sql = mysqli_query($conn, "SELECT message,tstamp,veh_type_1,veh_type_2  id FROM messages order by id desc");
  
      $result = mysqli_fetch_array($sql);
      echo '&lt;div class="message-wrap"&gt;' . $result['message'] . '&lt;/div&gt;';
  }
  ?&gt;
  </code></pre>
  
  <p>The table structure is as follows:-</p>
  
  <pre><code> #database=test, table_name=messages
  1   idPrimary   int(11)             No  None        AUTO_INCREMENT      
  2   message     text        latin1_swedish_ci       Yes     NULL                
  3   tstamp      float           No  None            
  4   veh_type_1  varchar(5)  latin1_swedish_ci       No  None            
  5   veh_type_2  varchar(5)  latin1_swedish_ci       No  None            
  </code></pre>
  
  <p><strong>EDIT : added the ajax code to index.html, still when I click submit, it says submitted but nothing is updated in table</strong></p>