Esempio n. 1
0
<?php

require_once "../../config/init.php";
require_once "StaticUtil.php";
//Set page information
$display["title"] = "How To Order";
$display["metakey"] = "";
$display["metadesc"] = "";
$display["body"] = "how-to-order.php";
$display["body_title"] = "How To Order";
$display["js_head"][] = "contact-form.js";
$display["js_head"][] = "how-to-order.js";
$display["regarding"] = array("Sales Inquiry");
//Set the form type so that the contact form sends the appropriate email
$display["form_type"] = "how-to-order";
//Get any product info which is used to populate the
$display["z"]["message"] = StaticUtil::build_order_message($z["prod"]);
//Setup params for class init
$p["display"] = $display;
$page->set_all($p);
$page->display();
    $errors[] = "Please enter your last name";
}
if (empty($z["email"]) || !is_valid_email($z["email"])) {
    $errors[] = "Please enter a valid email address";
}
if (empty($z["message"])) {
    $errors[] = "Please enter your message";
}
if (!captcha_verify_word()) {
    $errors[] = "Authentication code did not match image, please try again";
}
//Let's send ourselves the email
if (!array_valid($errors)) {
    switch ($z["form_type"]) {
        case "how-to-order":
            StaticUtil::email_order_form($z);
            break;
        case "contact-us":
            StaticUtil::email_contact_form($z);
            break;
    }
    //Display the errors so user can make updates - this is only here if js check fails
} else {
    $display["errors"] = $errors;
}
$display["body"] = "ajax/contact-form-validation.php";
$display["layout"] = "layout_ajax.php";
//Setup params for class init
$p["display"] = $display;
$page->set_all($p);
$page->display();