title: Delete Button (to delete rows in phpmyadmin table)
body: <p>I am doing a website with login system were each user can insert and view his logs.</p>
  
  <p>Now I am trying to make a delete button that when clicked an entire row from a table is deleted.</p>
  
  <p>It is working fine because when I click the "DELETE BUTTON" and check the rows from thee phpmyadmin shell the row is no longer there.</p>
  
  <p>The problem is that on the first click the row is still visible in the webpage and only when I click the button again it disappears!</p>
  
  <p>Here is my code: -</p>
  
  <pre><code>&lt;?php   
      $entries = mysql_query("SELECT `id`,`date`, `location`, `description` FROM `logs` WHERE `username` = '$current_user'");
  
  
  if(mysql_num_rows($entries)==0){
  
      echo 'No entries, yet.';}
      else{
  
  
          while($entries_row = mysql_fetch_assoc($entries)){          
              echo    " 
                  &lt;hr&gt; 
                  &lt;form action='' method='post'&gt; 
                  &lt;input type='hidden' name='id' value='".$entries_row['id']."'&gt; 
                  &lt;table align='center' border='1' width='80%' cellpadding='5'&gt; 
                  &lt;tr&gt; 
                  &lt;td width='20%'&gt;&lt;strong&gt;Date:&lt;/strong&gt;&lt;/td&gt; 
                  &lt;td&gt;" . $entries_row['date'] . "&lt;/td&gt; 
                  &lt;/tr&gt;     
                  &lt;tr&gt; 
                  &lt;td width='20%'&gt;&lt;strong&gt;Location:&lt;/strong&gt;&lt;/td&gt; 
                  &lt;td&gt;" . $entries_row['location'] . "&lt;/td&gt; 
                  &lt;/tr&gt; 
                  &lt;tr&gt; 
                  &lt;td width='20%'&gt;&lt;strong&gt;Description:&lt;/strong&gt;&lt;/td&gt; 
                  &lt;td&gt;" . $entries_row['description'] . "&lt;/td&gt; 
                  &lt;/tr&gt; 
                  &lt;tr&gt; 
                  &lt;td colspan='2' align='right'&gt;&lt;input type='submit' name='delete' value='Delete Entry'&gt;&lt;/td&gt; 
                  &lt;/tr&gt; 
                  &lt;/table&gt; 
                  &lt;/form&gt; 
                      "; 
          }
      }   
  
  }else{
      echo 'Could not connect at this time.';
  }
  
  if(isset($_POST['delete']))
      { 
      mysql_query("DELETE FROM `logs` WHERE `id` = '".$_POST['id']."' ");
      } 
  
  
  ?&gt;
  </code></pre>