$logRec = new LogRecord(); if ($status == "success") { // Everything is OK. Do the DELETE: $logRec->setId($logRecordId); if (!$logRec->deleteRecord()) { $status = "fail"; $errors[deleteRecordFailed] = "Failed to delete record."; } } header("content-type: text/xml"); ?> <DeleteLogRecord> <logId><?php echo $logRec->getId(); ?> </logId> <status><?php echo $status; ?> </status> <?php foreach ($errors as $key => $value) { ?> <error id="<?php echo $key; ?> "><?php echo $value; ?>