// Escape comment for presentation.
 $time_rec['comment'] = htmlspecialchars($time_rec['comment']);
 
-if ($request->getMethod() == 'POST') {
+if ($request->isPost()) {
   if ($request->getParameter('delete_button'))  {  // Delete button pressed.
 
     // Determine if it's okay to delete the record.