title: Php delete row onclick
body: <p>Hi guys i have this problem.
  I have a while loop that shows me the values ​​of a table. Now I need you may delete one of them, if it is wrong.
  I just can not run this code , I do not understand what is wrong.
  This is my php where i have the problem.</p>
  
  <pre><code>while( $row = mysql_fetch_array( $res ))
  {
  
  echo "&lt;tr&gt;
  
    &lt;td&gt; ".$row['id']."&lt;/td&gt;
    &lt;td&gt; ".$row['val1']."&lt;/td&gt;
  
    &lt;form action='' method='POST'&gt;
    &lt;input type='submit' name='delete' value='".$row['id']."' /&gt;&lt;/td&gt;
    &lt;/form&gt;
    &lt;/tr&gt;";
  
  }
  
  if(isset($_POST['delete'])){
  
  
  $user  = $_POST['delete'];
  $delet_query = mysql_query("DELETE FROM table_name WHERE id = '$user' ") or die(mysql_error());
  
  if($delet_query) {
  echo "Delete success!";
  
  }
  }
  </code></pre>
  
  <p>Why don't work? Thanks a lot man!
  I need the user can delete the row.</p>