function newMessagePost() { // sanitises data input from form. $receiver = htmlspecialchars(trim($_POST["receiver"])); $subject = htmlspecialchars(trim($_POST["subject"])); $message = htmlspecialchars(trim($_POST["message"])); //if successful redirect to sentbox with confirmation message if (empty($receiver) or empty($subject) or empty($message)) { checkEmptyValues($receiver, $subject, $message); } else { if (ModelFacade::createMsg($receiver, $subject, $message)) { header("location:DirectMsgSent.php?newMsgSent=true"); } else { header("location:DirectMsgSent.php?newMsgSent=false"); } } }