How can the Delete button be properly defined in PHP to ensure it functions correctly?

When defining the Delete button in PHP, it is important to make sure that it is linked to the correct action, such as deleting a specific record from a database. The button should be inside a form element with the method set to "POST" and include a hidden input field containing the unique identifier of the record to be deleted. Upon clicking the Delete button, the form should be submitted to a PHP script that processes the deletion based on the provided identifier.

<form method="POST" action="delete.php">
    <input type="hidden" name="id" value="<?php echo $record_id; ?>">
    <button type="submit" name="delete">Delete</button>
</form>