title: How do I fix the deletion of current row when an img is clicked?
body: <p>I've been cracking my head at trying to use a modal as a confirmation to delete a specific row from my database. The SQL works, but only without the modal. (the modal is required)</p>
  
  <p>From earlier searches I have tried and failed to implement the tips from <a href="https://stackoverflow.com/questions/22296054/bootstrap-modal-confirmation-delete">a different question</a>.</p>
  
  <pre><code>    while ($row = $statement -&gt;fetch(PDO::FETCH_ASSOC)) {
  
      Here I create a variable to use later
      &lt;?php $username = $row['username']; ?&gt;   
  
          &lt;td&gt;
              &lt;div class="adjust-buttons"&gt;
  
                  &lt;input 
                  type="image" 
                  id="delete" 
                  alt="delete" 
                  src="../img/delete.png" 
                  onclick="showModal();" 
                  onmouseover="this.src='../img/delete-hover.png';" 
                  onmouseout="this.src='../img/delete.png';"&gt;
  
  
                  &lt;div id="myModal" class="modal"&gt;
                      &lt;div class="modal-content"&gt;
  
                          &lt;h3&gt;Delete user&lt;/h3&gt;
  
                          &lt;?php
                      echo 'are you sure you want ' .$username. '     removed?';
                          ?&gt;
  
                          &lt;input 
                              class="modal-button" 
                              type="button" 
                              value="Cancel" 
                              onclick="hideModal();"&gt;
  
                          &lt;input 
                              class="modal-button" 
                              type="button" 
                              value="I'm sure" 
                              id="&lt;?php echo $row['username']; ?&gt;" 
                              onclick="document.location.href='../delete-user/delete-user.php?username=&lt;?php echo $row['username']?&gt;'" /&gt;
                          &lt;/div&gt;
  
                      &lt;/div&gt;
                  &lt;/div&gt;
          &lt;/td&gt;
      &lt;/tr&gt;
  
      &lt;?php } ?&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>I expected the row deleted to be the one which is selected from the loop. This is not the case, only the first created row is selected no matter which delete button I press.</p>