Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php defined('C5_EXECUTE') or die(_("Access Denied.")); ?>
- <?php
- $output = '';
- $required = array('email', 'first_name', 'last_name');
- $disclaimer = (' <div class="disclaimer"> If you are interested in receiving Brix updates and special offers by snail mail, please complete the following: </div> ');
- $errors = array();
- if (! empty($_POST)) {
- foreach ($required as $field) {
- if ( empty($_REQUEST[$field])) {
- $errors[$field] = 'this is required';
- }
- }
- if (count($errors) < 1) {
- // Send an email
- if ($_POST) {
- if (get_magic_quotes_gpc()) {
- foreach ($_POST as $key=>$value) {
- $temp = stripslashes($value);
- $_POST[$key] = $temp;
- }
- }
- $to = $_POST['to']; // emailsubmissions@siteowner.com
- $subject = $_POST['Posted From Website']."\n";
- $message .= "Email: ".$_POST['email']."\n";
- $message .= "First Name: ".$_POST['first_name']."\n";
- $message .= "Last Name: ".$_POST['last_name']."\n";
- $message .= "Address: ".$_POST['address']."\n";
- $message .= "City: ".$_POST['city']."\n";
- $message .= "State: ".$_POST['state']."\n";
- $message .= "Country: ".$_POST['country']."\n";
- $message .= "Zip: ".$_POST['zip']."\n";
- $message .= "Phone Number: ".$_POST['phone_number']."\n";
- $message .= "Message: ".$_POST['message']."\n";
- $headers = "From: marypatc@turnpost.com\n"; // from address on the email to the site owner
- $headers .= "Content-type: text/plain; charset=UTF-8";
- $sent = mail($to, $subject, $message, $headers);
- // echo $message;
- }
- $output .= '<p style="padding-bottom:20px;">';
- $output .= '<strong>Email Sent!</strong> Thank you for contacting us. Click <a style="color:#830024;" href="/index.php">Here</a> to return.';
- $output .= '</p>';
- echo $output;
- return;
- } else {
- echo '<span class="error">Please fill in the following fields...</span><ul>';
- foreach ($errors as $error => $value) {
- echo '<li class="newerror">'.ucwords(str_replace('_',' ',$error)).' - '.$value.'</li>';
- }
- echo '</ul>';
- }
- }
- $output .= '<form method="post" id="contactform" name="contactform" action="'.$_SERVER['PHP_SELF'].'">';
- $output .= '<table class="clearfix">';
- $fields = array( 'to'=>'dropdown', 'email'=>'text', 'first_name'=>'text', 'last_name'=>'text' );
- echo $disclaimer;
- $fields = array( 'address'=>'text', 'city'=>'text', 'state'=>'text', 'country'=>'text', 'zip'=>'text', 'phone_number'=>'text', 'message'=>'textarea' );
- $drops = array('Book a meeting or event'=>'hospitality@brixomaha.com', 'Stay In Touch'=>'info@brixomaha.com');
- foreach ($fields as $field=>$type) {
- if ($type != 'hidden') {
- $output .= '<tr><td><label for="'.$field.'" id="'.$field.'_label">';
- $output .= ucwords(str_replace('_',' ',$field));
- if (isset($errors[$field])) {
- $output .= ' <strong class="error"> *</strong>';
- }
- $output .= ': </label></td>';
- }
- switch ($type) {
- case 'textarea':
- $output .= '<td class="text"><textarea name="'.$field.'" id="'.$field.'" cols="30" rows="10">';
- if (isset($_REQUEST[$field])) {
- $output .= htmlspecialchars($_REQUEST[$field]);
- }
- $output .= '</textarea></td></tr>';
- break;
- case 'hidden';
- $output .= '<input type="hidden" name="'.$field.'" id="'.$field.'" value=""';
- if (isset($_REQUEST[$field])) {
- $output .= ' value="'.htmlspecialchars($_REQUEST[$field]).'"';
- }
- $output .= ' />';
- break;
- case 'dropdown';
- $output .= '<td><select name="'.$field.'" id="'.$field.'">';
- foreach ($drops as $option=>$address) {
- $output .= '<option value="'.$address.'">'.$option.'</option>';
- }
- $output .= '</select></td></tr>';
- break;
- default:
- $output .= '<td><input type="text" name="'.$field.'" id="'.$field.'"';
- if (isset($_REQUEST[$field])) {
- $output .= ' value="'.htmlspecialchars($_REQUEST[$field]).'"';
- }
- $output .= ' /></td></tr>';
- break;
- }
- }
- $output .= '
- </table>
- <input class="submit" type="submit" name="submit" value="Submit" />
- </form>
- ';
- echo $output;
Add Comment
Please, Sign In to add comment