title: PHP - Reacting on a dynamic created "Delete-Button"
body: <p>Hope you´re doing well today. ;)</p>
  
  <p>First of all, here is my problem:</p>
  
  <p>Im loading data from my database table dynamic in a HTML-table. So far, so good.
  The dynamic loading of the data in my HTML table works pretty well...</p>
  
  <p>Now, I want to check if the delete button is pressed and also want the ID from the record where the delete button was pressed.</p>
  
  <p>The HTML table has the following values:
  id, FirstName, LastName, Radio-Button (To select the record which should be deleted later on), Delete - Button (To delete the selected record)</p>
  
  <p>Here is my source Code:</p>
  
  <pre><code>&lt;?php
  
  $query = $con-&gt;prepare("SELECT id, vorname, nachname, herkunftsland FROM schauspieler;");
  $query-&gt;bind_result($id, $firstname, $lastname, $city);
  $query-&gt;execute();
  
  while($query-&gt;fetch()) {
  
      $actor_information[$id]['id'] = $id;
      $actor_information[$id]['firstname'] = $firstname;
      $actor_information[$id]['lastname'] = $lastname;
      $actor_information[$id]['city'] = $city;
  }
  
  ?&gt;
  
  &lt;html&gt;
  &lt;head&gt;
      &lt;title&gt;&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;p&gt;&lt;/p&gt;
  &lt;h4&gt;Actors:&lt;/h4&gt;
  &lt;hr /&gt;&lt;br /&gt;
  
  &lt;!--
  &lt;table border="3"&gt;
  &lt;tr&gt;
      &lt;td&gt;&lt;input type="radio" name="1"&gt;&lt;/input&gt;&lt;/td&gt;
      &lt;td&gt;&lt;input type="radio" name="1"&gt;&lt;/input&gt;&lt;/td&gt;
      &lt;td&gt;&lt;input type="radio" name="1"&gt;&lt;/input&gt;&lt;/td&gt;
      &lt;td&gt;&lt;input type="radio" name="1"&gt;&lt;/input&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;/table&gt;
  --&gt;
  
  &lt;form action="" method="post"&gt;
  &lt;table border="3"&gt;
      &lt;th&gt;id&lt;/th&gt;
      &lt;th&gt;FirstName&lt;/th&gt;
      &lt;th&gt;LastName&lt;/th&gt;
      &lt;th&gt;City&lt;/th&gt;
      &lt;?php
  
      foreach($actor_information as $key =&gt; $value) {
  
          echo "&lt;tr&gt;";
          printf("&lt;td&gt;%s&lt;/td&gt;&lt;td&gt;%s&lt;/td&gt;&lt;td&gt;%s&lt;/td&gt;&lt;td&gt;%s&lt;/td&gt;&lt;td&gt;&lt;input type='radio' name='dvd_id' value='%s'&gt;&lt;/input&gt;&lt;/td&gt;&lt;td&gt;&lt;input type='button' name='delete_actor' value='delete'&gt;&lt;/input&gt;&lt;/td&gt;", $value['id'], $value['firstname'], $value['lastname'], $value['city'], $value['id']);
          echo "&lt;tr&gt;";
      }
  
      ?&gt;
  &lt;/table&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Could anyone help me out to get the ID from the selected record...? I just need it to delete the record where the radio button is set.</p>
  
  <p>Hopefully I can get some help from you guys...</p>
  
  <p>Best regards &amp; have a nice day,
  Peter</p>