title: Database row is not deleting, AJAX, PHP error
body: <p>I want to remove DB row data from HTML table. I have an HTML table where I have called all the database table values. I want to give a delete order option to the user. I have used a delete button for that. To do this, I am trying to use ajax and jquery with php delete query. But the issue is When I click on delete it just deletes the HTML row data. It should delete that particular id row from DB as well. I need your help. Please let me know what I have done wrong? I am very much new to ajax and jquery.</p>
  
  <p>remove.php</p>
  
  <pre><code>&lt;?php 
  include "config.php";
  
  $id = $_REQUEST['id'];
  
  // Delete record
  $query = "DELETE FROM mi_home_tv WHERE id='$id'";
  mysqli_query($link,$query);
  
  echo 1;
  
  jquery+ajax code
  &lt;script src='jquery-3.0.0.js' type='text/javascript'&gt;&lt;/script&gt;
  &lt;script type="text/javascript"&gt;
      $(document).ready(function(){
  
      // Delete 
      $('.delete').click(function(){
          var el = this;
          var id = this.id;
          var splitid = id.split("_");
  
          // Delete id
          var deleteid = splitid[1];
  
          // AJAX Request
          $.ajax({
              url: 'remove.php',
              type: 'POST',
              data: { id:deleteid },
              success: function(response){
  
                  // Removing row from HTML Table
                  $(el).closest('tr').css('background','tomato');
                  $(el).closest('tr').fadeOut(800, function(){      
                      $(this).remove();
                  });
              }
          });
      });
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>Button Code:</p>
  
  <pre><code>echo "&lt;td&gt; &lt;span  id='del_&lt;?php echo $id; ?&gt;'  type='submit' class=' delete btn c-theme-btn c-btn-uppercase btn-xs  c-btn-square c-font-sm'&gt;Delete&lt;/span&gt; &lt;/td&gt;";
  </code></pre>
  
  <p>php code:</p>
  
  <pre><code> &lt;form method="post" action="remove.php"&gt;
                                          &lt;?php
                                         echo " &lt;thead&gt;
                                              &lt;tr&gt;
  
                                                  &lt;th&gt;Order ID&lt;/th&gt;
                                                  &lt;th&gt;Date&lt;/th&gt;
                                                  &lt;th&gt;Name&lt;/th&gt;
                                                   &lt;th&gt;Store Name&lt;/th&gt;
                                                  &lt;th&gt;Zip&lt;/th&gt;
                                                  &lt;th&gt;City&lt;/th&gt;
                                                  &lt;th&gt;Address&lt;/th&gt;
                                                   &lt;th&gt;Contact&lt;/th&gt;
                                                    &lt;th&gt;Tv Varient&lt;/th&gt;
                                                    &lt;th&gt;Total&lt;/th&gt;
                                                     &lt;th&gt;Delivery&lt;/th&gt;
                                                    &lt;th&gt;Action&lt;/th&gt;
                                              &lt;/tr&gt;
                                          &lt;/thead&gt;
  
                                                &lt;tbody&gt;";
                                                 while($row = mysqli_fetch_array($result))
                                            {
                                               $id = $row['id'];
  
                                             echo"&lt;tr&gt;";
                                                  echo "&lt;td&gt;" . $row['id'] . "&lt;/td&gt;";
                                                  echo "&lt;td&gt;" . $row['rdate'] . "&lt;/td&gt;";
                                                  echo "&lt;td&gt;" . $row['rname'] . "&lt;/td&gt;";
                                                  echo "&lt;td&gt;" . $row['rstore'] . "&lt;/td&gt;";
                                                  echo " &lt;td&gt;" . $row['rzip'] . "&lt;/td&gt;";
                                                  echo "&lt;td&gt;" . $row['rcity'] . "&lt;/td&gt;";
                                                  echo "&lt;td&gt;" . $row['raddress'] . "&lt;/td&gt;";
                                                  echo "&lt;td&gt;" . $row['rphone'] . "&lt;/td&gt;";
                                                  echo "&lt;td&gt;" . $row['rtv_varient'] . "&lt;/td&gt;";
                                                  echo"&lt;td&gt;" . $row['ramount'] . "&lt;/td&gt;";
                                                  echo"&lt;td&gt;" . $row['rdelivery'] . "&lt;/td&gt;";
  
                                                  echo "&lt;td&gt; &lt;input type='submit' value='delete'  id='del_&lt;?php echo $id; ?&gt;' type='submit' class=' delete btn c-theme-btn c-btn-uppercase btn-xs  c-btn-square c-font-sm'&gt;Delete&lt;/button&gt; &lt;/td&gt;";
  
                                                    echo"&lt;/tr&gt;";
  
  
                                                   }
                                                   ?&gt;
                                               &lt;/form&gt;
  </code></pre>