<?php
require_once 'core.php';

  $chat_message = $_POST['chat_message'];
  $email_guest = $_POST['email_guest'];
  
  // $email = 'administrator';
  $username = 'admin';

  $admin_name = $_SESSION['username'];

  $status = '1';

 $query = "INSERT INTO txmessage_guest 
         (ftemail, ftusername, ftrecipient_msg, ftfill_msg,fnstatus) 
   VALUES ('$admin_name', '$username','$email_guest', '$chat_message', '$status')";
 
  $result = mysqli_query($link,$query);

  //ketika chat berhasil terkirim maka chat history akan tampil 
  
  if($result){
 
    echo tampil_chat_guest($admin_name,$email_guest);

  }
  

?>
