$path = $_SERVER['DOCUMENT_ROOT'] . "/path.php";
require_once $path;
include $config;
$functions = $pathofmayo . "/classes/functions.php";
include $functions;
$meshedfile = $pathofmayo . "/attorney/classes/meshed.php";
require_once $meshedfile;
$getdata = new Meshed();
$admin = $_SESSION['username'];
$admin_id = $getdata->GetDetailsByUsername($admin, "id");
$status = $_REQUEST['status'];
$form_s_id = $_REQUEST['fid'];
$use_id = $_REQUEST['uid'];
$statusArea = $_REQUEST['statusComment'];
$query = mysql_query("INSERT INTO `status_update` (`form_id`,`user_id`,`main_user_id`,`status_messages`,`status_notes`,`date_status`) \n\tVALUES ('{$form_s_id}','{$use_id}','{$admin_id}','{$status}','{$statusArea}',now())") or die(mysql_error());
$hiresId = $getdata->getHiredStaff($form_s_id);
/*
	Get information from the hire staff to send the status update emails to all of them
*/
// Insert Status in the latest Messages
$clientName = $getdata->GetInfoPlantiffInformation("plantiff_name", $form_s_id);
$messageSent = $clientName . " has changed Status to " . $status;
$notification = mysql_query("INSERT INTO `notifications` (`user_id`,`form_id`,`main_id`,`message`) VALUES ('{$use_id}','{$form_s_id}','{$admin_id}','{$messageSent}')") or die(mysql_error());
$insertStatus = mysql_query("INSERT INTO `message_sent` (`form_id`,`user_id`,`sent_by`,`main_user_id`,`message`,`date_message`) VALUES ('{$form_s_id}','{$use_id}','{$admin_id}','{$hiresId}','{$messageSent}',now())") or die(mysql_error());
if ($query) {
    echo "<div class='thank_message'>Status is Successfully Updated</div>";
} else {
    echo "<div class='thank_message'>There is some problem</div>";
}
?>
	<div class="update_status_botom">