<?php
require_once 'core.php';

  $username_guest = $_POST['username_guest'];
  $chat_message = $_POST['chat_message'];
  $admin_name   = $_POST['admin_name'];
  $email_guest = $_POST['email_guest'];

  $status = '1';

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

 $result = mysqli_query($link,$query);

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

  }
  

?>
