title: Deleting a row from a generated HTML table
body: <p>My website will create a table from a MySQL database. I was wondering if their was a way to have a delete button next to each row so members can delete specific rows on their table. Everything else works fine. I would like users to be able to delete their rows from their table.</p>
  
  <pre><code>&lt;form action="addcel.php" method="post"&gt;
  Name &lt;input type="text" name="Name"/&gt;
  Year &lt;input type="text" name="year"/&gt;
  &lt;input type="submit" /&gt;
  
  &lt;html&gt;&lt;head&gt;&lt;title&gt;MySQL Table Viewer&lt;/title&gt;&lt;/head&gt;&lt;body&gt;
  &lt;?php
  echo "&lt;style type = 'text/css'&gt;
  
  table {width:700px;border:none;text-align:center;background-color:#B0B0B0;font-family:'Arial';}
  
  #tabledata {padding:2px;border-width:0px;}
  
  #tableheader {border-width:0px;}
  
  #line {border:1px solid black;padding:0px;}
  
  &lt;/style&gt;";
  $db_host = 'localhost';
  $db_user = 'root';
  $db_pwd = '';
  
  $database = 'Name_gage';
  $table = 'Name';
  
  if (!mysql_connect($db_host, $db_user, $db_pwd))
      die("Can't connect to database");
  
  if (!mysql_select_db($database))
      die("Can't select database");
  
  // sending query
  $result = mysql_query("SELECT * FROM {$table}");
  if (!$result) {
      die("Query to show fields from table failed");
  }
  
  $fields_num = mysql_num_fields($result);
  
  echo "&lt;h1&gt;Table: {$table}&lt;/h1&gt;";
  echo "&lt;table border='1'&gt;&lt;tr&gt;";
  // printing table headers
  for($i=0; $i&lt;$fields_num; $i++)
  {
      $field = mysql_fetch_field($result);
      echo "&lt;th id = 'tableheader'&gt;{$field-&gt;name}&lt;/th&gt;";
  }
  echo "&lt;/tr&gt;\n";
  echo "&lt;tr&gt;&lt;td id = 'line'&gt;&lt;/td id = 'line'&gt;&lt;td id = 'line' &gt;&lt;/td&gt;&lt;td id = 'line' &gt;&lt;/td&gt;&lt;td id = 'line' &gt;&lt;/td&gt;&lt;td id = 'line' &gt;&lt;/td&gt;&lt;/tr&gt;";
  // printing table rows
  while($row = mysql_fetch_row($result))
  {
      echo "&lt;tr&gt;";
  
      // $row is array... foreach( .. ) puts every element
      // of $row to $cell variable
      foreach($row as $cell)
          echo "&lt;td id = 'tabledata'&gt;$cell&lt;/td&gt;";
  
      echo "&lt;/tr&gt;\n";
  }
  mysql_free_result($result);
  ?&gt;
  &lt;/body&gt;&lt;/html&gt;
  </code></pre>