$mode = 'add';
 } else {
     if ($action == 'create') {
         if ($objListingsSubLocations->AddRecord()) {
             $msg = draw_success_message(_ADDING_OPERATION_COMPLETED, false);
             $mode = 'view';
         } else {
             $msg = draw_important_message($objListingsSubLocations->error, false);
             $mode = 'add';
         }
     } else {
         if ($action == 'edit') {
             $mode = 'edit';
         } else {
             if ($action == 'update') {
                 if ($objListingsSubLocations->UpdateRecord($rid)) {
                     $msg = draw_success_message(_UPDATING_OPERATION_COMPLETED, false);
                     $mode = 'view';
                 } else {
                     $msg = draw_important_message($objListingsSubLocations->error, false);
                     $mode = 'edit';
                 }
             } else {
                 if ($action == 'delete') {
                     if ($objListingsSubLocations->DeleteRecord($rid)) {
                         $msg = draw_success_message(_DELETING_OPERATION_COMPLETED, false);
                     } else {
                         $msg = draw_important_message($objListingsSubLocations->error, false);
                     }
                     $mode = 'view';
                 } else {