$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();