<?php if (!empty($_SESSION['msg']) && !empty($_SESSION['type'])): ?>
<script>
  document.addEventListener('DOMContentLoaded', function() {
    Swal.fire({     
      text: <?= json_encode($_SESSION['msg']) ?>,
      icon: <?= json_encode($_SESSION['type']) ?>,
      confirmButtonText: 'OK'
    });
  });
</script>
<?php
unset($_SESSION['msg'], $_SESSION['type']);
endif;
?>

