Here's a short code snippet demonstrating how to use confirm_form() in a menu callback for Drupal 7.
<?php
function examplemodule_menu_callback($entity_id) {
$form = array(
'entity_id' => array(
'#type' => 'value',
'#value' => $entity_id,
),
);
return confirm_form($form, 'Are you sure?', 'path/when/cancelled');
}
?>