Пример #1
0
$error = 0;
// initialize variables
$fromName = "";
$fromEmail = "";
$message = "";
if (!empty($_POST['action']) && $_POST['action'] == "contactus") {
    if (!empty($_POST['mail'])) {
        $error = 1;
    } else {
        $fromName = filter_input(INPUT_POST, 'InputName', FILTER_SANITIZE_STRING);
        $fromEmail = filter_input(INPUT_POST, 'InputEmail', FILTER_SANITIZE_STRING);
        $message = filter_input(INPUT_POST, 'InputMessage', FILTER_SANITIZE_STRING);
        if (empty($fromName) || empty($fromEmail) || empty($message)) {
            $error = 1;
        } else {
            $result = $qbc->sendEmail($fromName, $fromEmail, $message);
            if ($result) {
                $success = 1;
                $fromName = "";
                $fromEmail = "";
                $message = "";
            } else {
                $error = 1;
            }
        }
    }
}
?>
<!doctype html>
<html lang="us">
<head>