I am building a website that on a page prints each book record in the database. I have a Delete button and an Update button associated with each record in the database.

I am currently trying to write the code for the Delete button. Unfortunately, it is not working out. I want to know if someone can help.

Here is the relevant code from the html file.

Code:
while ($row = mysqli_fetch_array($result)) 
 {

 echo '<div id="inputNote">';

$time = strtotime($row['date']);

echo '<div id = "infoNote">';
echo '<div id = "titleauthorNote">';
echo '<h3>' . htmlspecialchars($note['title'], ENT_QUOTES, 'UTF-8') . '</h3>';
echo '<p>' . htmlspecialchars($note['author'], ENT_QUOTES, 'UTF-8') . '</p>';

echo '</div>';
echo '</div>';

$book_id_number = htmlspecialchars($note['book_id_number'], ENT_QUOTES, 'UTF-8');

echo '</div>' ;
echo '<div id = "publisherNote">' ;
echo '<p>' . 'Published on' . " " . htmlspecialchars(date('F j, Y,', $time),    
ENT_QUOTES, 'UTF-8') . 
" " . 'by' . " " . htmlspecialchars($note['publisher'], ENT_QUOTES, 'UTF-8') . '</p>';
echo '</div>';
echo '<div id = "deletedForm">';
echo '<form name="formDelete" method="post" id="formDelete" action="control.php">'; 
echo '<input type="submit" value="Update" name="myUpdate" id="myUpdate" style = "width:  
100px" required>';
echo '<input type="submit" value="Delete" name="myDelete" id="$book_id_number" style = "width: 
100px" required>';
echo '</form>';
echo '</div>';
echo '</div>';
echo '<hr>' ;

echo '</div>';
}
?>

Here is the code from my php file.

Code:
else if (isset($_POST['myDelete']))
{
$id_number = mysqli_real_escape_string($link, $_POST['id']);    

$sql="DELETE FROM readbooks WHERE book_id_number = '$id_number'";

if (!mysqli_query($link, $sql))   

{   

$error = 'Error with submission: ' . mysqli_error($link);   

exit();   

  } 
}