\n

T H A N K   Y O U !


\nYour Form Submission has been sent.





\n
\n"); define("STYLE_BODY", "FONT-SIZE:12px; font-family:arial; background-image: url('images/sand_body_bg.jpg'); background-position: center;"); define("STYLE_ERR_MSSG", "COLOR:red; FONT-SIZE:12px; FONT-WEIGHT:Normal; TEXT-DECORATION:none; font-family:arial; line-height:12px"); define("STYLE_REQ_NO", "COLOR:#cc3333; FONT-SIZE:13px; FONT-WEIGHT:normal; TEXT-DECORATION:none;"); define("STYLE_REQ_YES", "COLOR:#cc3333; FONT-SIZE:13px; FONT-WEIGHT:bold; TEXT-DECORATION:none;"); define("STYLE_REQ_ERR", "COLOR:#FF0000; FONT-SIZE:13px; FONT-WEIGHT:bold; TEXT-DECORATION:none;"); define("STYLE_FIELDSET", "BORDER:solid 1px white;"); define("STYLE_LEGEND", "COLOR:#cc3333; FONT-SIZE:20px; FONT-WEIGHT:bold;"); define("STYLE_SUBMIT", "COLOR:#cc3333; FONT-SIZE:11px; FONT-WEIGHT:bold; TEXT-DECORATION:none; font-family:arial;"); define("STYLE_DIV", "BORDER:1px solid red; "); //=============================================================================================================================== // S T A R T M A I N C O N T R O L - Every page run is controled from this section //=============================================================================================================================== global $error_array; if ( $_SERVER['CONTENT_LENGTH'] == 0 ){ // 1 This is the first run of the form begin_page(); // Start the html page begin_form(); // Start the form build_states_array(); // Make an associative array with the state values build_main_form(); // Creates the shipping info form end_form(); // End the form end_page(); // End the html page } else { // 2 The form has been submitted $error_array = validate_input(); // Checks for invalid data in the fields if (isset($error_array)) { // 3 The form has been submitted but has data error begin_page(); // Start the html page begin_form(); // Start the form display_errors(); // Write the error messages on top of the form build_states_array(); // Make an associative array with the state values build_main_form(); // Creates the shipping info form end_form(); // End the form end_page(); // End the html page } else { // 4 The form has been submitted and has no invalid data email_form_info(); // Email the form info to the client begin_page(); // Start the html page echo FRM_CUSTOM_THANK_YOU; end_page(); // End the html page } //end if } //end if //=============================================================================================================================== // E N D M A I N C O N T R O L //=============================================================================================================================== //=============================================================================================================================== function validate_input() { global $focus_field; $focus_field = ""; foreach ($_POST as $field_name => $field_value){ $field_value = trim($field_value); $error_message = ""; switch (strtolower($field_name)) { case "first_name": case "last_name": case "address": case "city": if ( strlen($field_value) == 0 ) $error_message = add_space($field_name)." is required."; break; case "zip_code": if (strlen($field_value)==0) { $error_message = add_space($field_name)." is required."; } elseif (!is_numeric($field_value)) { $error_message = add_space($field_name)." is not numeric."; } elseif (strlen($field_value)<5) { $error_message = add_space($field_name)." must contain 5 digits."; } //end if break; case "phone": if (strlen($field_value) < 1) { //$error_message = add_space($field_name) . " is required."; } else { $response = format_phone_num($field_value); if ( $response == "NOT_VALID") { $error_message = add_space($field_name) . " is not valid."; } else { $_POST[$field_name] = $response; } //end if } //end if break; case "email_address": if ( strlen($field_value) < 1 ) { $error_message = add_space($field_name)." is required."; } elseif (! eregi('^[[:alnum:]][a-z0-9_\.\-]*@[a-z0-9\.\-]+\.[a-z]{2,4}$', stripslashes(trim($field_value)))) { $error_message = add_space($field_name)." is invalid."; } //end if break; default: break; } //end switch if ($error_message != "") { $error_key .= $field_name . ","; $error_val .= $error_message . ","; if ( $focus_field == "" ) $focus_field = $field_name; } //end if } // - END OF LOOP - END OF LOOP - END OF LOOP - END OF LOOP - END OF LOOP - $error_key = rtrim($error_key, ","); $error_val = rtrim($error_val, ","); if (! empty($error_key) ) { $error_array = str_to_array($error_key, $error_val); } //end if return $error_array; } //end function //============================================================================================================================= ///\\//\\ NO NEED TO EDIT BELOW THIS LINE //\\//\\ NO NEED TO EDIT BELOW THIS LINE //\\//\\ NO NEED TO EDIT BELOW THIS LINE //============================================================================================================================= function begin_page() { echo "\n"; echo "\n"; echo "\n"; //echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo " \n"; echo " \n"; echo " \n"; echo "
\n"; } //end function //=============================================================================================================================== function begin_form() { echo "
\n"; echo "
\n"; echo "   ".FRM_LEGEND."  \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; if ($_SERVER['CONTENT_LENGTH'] == 0 ) { echo " \n"; echo " \n"; echo " \n"; } //end if } //end function //=============================================================================================================================== function build_main_form() { global $states_array; insert_hr_in_email("WEBSITE CONTACT
DaytonaOceanRentals.com"); make_disabled_field("Listing" , 30, 32); make_form_field("First_Name" , 30, 32 ,"*"); make_form_field("Last_Name" , 30, 32 ,"*"); //make_form_field("Business_Name" , 26, 32 ,""); //make_form_field("Address", 26, 50 ,"*"); //make_form_field("City" , 26, 50 ,"*"); //make_drop_down ("State",$states_array,"FL" ,"*"); //make_form_field("Zip_Code" , 26, 5 ,"*"); make_form_field("Phone" , 30, 20 ,""); make_form_field("Email_Address" , 30, 100,"*"); make_text_area ("Comments" , 30, 6 ,""); } //end function //============================================================================================================================ function end_form() { global $focus_field; if ($focus_field == "" ) $focus_field = "First_Name"; echo " \n"; echo " \n"; echo " \n"; echo "
Please complete the form below
Bold Fields Are Required
\n"; echo "
\n"; echo " \n"; echo "
\n"; echo "
\n"; echo "
\n"; echo " \n"; } //end function //=============================================================================================================================== function end_page() { echo "
\n"; echo "\n"; echo "\n"; } //end function //=============================================================================================================================== function display_errors() { global $error_array; if ( count($error_array) > 0 ) { // errors were found echo " \n"; echo " \n"; echo " Please correct the following fields:\n"; foreach($error_array as $key => $val) { //Writes out the error messages echo "
"; echo $val . "\n"; } //next echo " \n"; echo " \n"; } // end if } // end function //=============================================================================================================================== function email_form_info() { $skip_fields = array("subject", "recipient", "ccopy", "bccopy", "redirect", "Submit", ); $message = ""; foreach ($_POST as $f_name => $f_value){ if (!in_array($f_name, $skip_fields)) { if (is_array($_POST["$f_name"])) { $message .= " " . add_space($f_name) . ": "; $i = 0; while($i <= sizeof($_POST["$f_name"])) { if ($_POST["$f_name"][$i] != "") { $message .= form_clean($_POST[$f_name][$i]) . ", "; } //end if $i++; } //NEXT $message = rtrim($message,", "); $message .= " \n"; } else { if ( substr($f_name, 0,11) == 'hr_in_email' ) { $message .= "
\n
" . str_replace(" ", " ", $f_value) . "
\n
\n"; } else { $message .= " " . set_nbsp($f_name) . add_space($f_name) . ": " . form_clean($f_value) . "
\n"; } //end if } //end if } //end if } //NEXT $mail_message=""; $mail_message.="\n"; $mail_message.="\n"; $mail_message.=" \n"; $mail_message.=" html email\n"; $mail_message.=" \n"; $mail_message.=" \n"; $mail_message.=" \n"; $mail_message.="\n"; $mail_message.=" \n"; $mail_message.=" \n"; $mail_message.=" \n"; $mail_message.="
\n"; $mail_message.=$message; $mail_message.="
\n"; $mail_message.="\n"; $mail_message.="\n"; $strName = trim($_POST["First_Name"]) . " " . trim($_POST["Last_Name"]); $to = FRM_MAIL_RECIPIENT; // $to = "anwar.shahid@gmail.com"; $subject = FRM_MAIL_SUBJECT; $header = ""; // $header .= "From: " . $strName . " <" .$_POST["Email_Address"] . "> \r\n"; $header .= "From: " . $strName . " \r\n"; $header .= "Reply-To: ".$_POST["Email_Address"]." \r\n"; $header .= "Date: ".date("r")."\r\n"; $header .= "Message-ID: <".date("YmdHis").$strName."@".$_SERVER['SERVER_NAME'].">\r\n"; $header .= "Return-Path: " . $strName . " <".$_POST["Email_Address"].">\r\n"; $header .= "MIME-Version: 1.0\r\n"; $header .= "Content-Type: text/html; charset=iso-8859-1\r\n"; //$header .= "Content-type: text/plain\r\n"; $header .= "X-Priority: 3\r\n"; $header .= 'X-Mailer: PHP/' . phpversion(); //echo "
"; print_r($_POST); echo "
"; echo $mail_message; exit; if ( ! mail($to,$subject,$mail_message,$header) ) { echo "EMAIL FAILURE"; } // end if } //end function //=============================================================================================================================== function set_nbsp($field_name) { $diff = LONGEST_FIELD_LEN - strlen($field_name); for($i = 0; $i < $diff; $i++) { $str .= " "; } //next return $str; } //end function //=============================================================================================================================== function make_form_field($strField,$strLen,$strMax,$strReq) { global $error_array; $img_cross = ""; if ($strReq=="*") { $strClass=STYLE_REQ_YES; //FIELD REQUIRED CLASS } else { $strClass=STYLE_REQ_NO; //FIELD NOT REQUIRED CLASS } //end if if ($error_array[$strField] != "") { $strClass=STYLE_REQ_ERR; //change text color b/c of errors $img_cross = " \n"; } //end if echo " \n"; echo " ".add_space($strField).":\n"; echo " \n"; echo $img_cross; echo " \n"; echo " \n"; } //end function //=============================================================================================================================== function make_text_area($strField,$strCols,$strRows,$strReq) { global $error_array; $img_cross = ""; if ($strReq=="*") { $strClass = STYLE_REQ_YES; //FIELD REQUIRED CLASS } else { $strClass = STYLE_REQ_NO; //FIELD NOT REQUIRED CLASS } //end if if ($error_array[$strField] != "") { $strClass = STYLE_REQ_ERR; //change text color b/c of errors $img_cross = " \n"; } //end if echo " \n"; echo " ".add_space($strField).":\n"; echo " \n"; echo " \n"; echo $img_cross; echo " \n"; echo " \n"; } // end function //=============================================================================================================================== function make_disabled_field($strField,$strLen,$strMax) { if ( trim($_POST[$strField]) <> "" ) { $strClass=STYLE_REQ_NO; //FIELD NOT REQUIRED CLASS echo " \n"; echo " ".add_space($strField).":\n"; echo " \n"; echo " \n"; echo " \n"; } //end if } //end function //=============================================================================================================================== function make_drop_down($name,$arr,$default,$strReq) { global $error_array; if ($strReq=="*") { $strClass=STYLE_REQ_YES; //FIELD REQUIRED CLASS } else { $strClass=STYLE_REQ_NO; //FIELD NOT REQUIRED CLASS } //end if if ($error_array[$strField] != "") { $strClass=STYLE_REQ_ERR; //change text color b/c of errors } //end if if ($_POST[$name] == "") $_POST[$name] = $default; echo " \n"; echo " ".add_space($name).":\n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; } // end function //=============================================================================================================================== function make_hidden_field($strField,$strValue) { echo " \n"; } //end function //=============================================================================================================================== function insert_hr_in_email($strValue) { echo " \n"; } //end function //=============================================================================================================================== function format_phone_num($field_value) { $strPhone = strtoupper($field_value); // uppercase all characters for consistency for ($i = 1; $i <= strlen($strPhone); $i++) { $iChar = substr($strPhone, $i-1, 1); if ( ord("0") <= ord($iChar) && ord($iChar) <= ord("9") ) { $strTemp = $strTemp.$iChar; } //end if } // end for if ( (strlen($strTemp) == 11) && (substr($strTemp,0,1) == "1") ) { // Remove leading 1 if applicable $strTemp = substr($strTemp, (strlen($strTemp) - 10)); } //end if if ( (strlen($strTemp) == 10) && (substr($strTemp,0,1) != "1") ) { // Build (XXX) XXX-XXXX $strPhone = "("; // "(" $strPhone = $strPhone.substr($strTemp,0,3); // Area code $strPhone = $strPhone.") "; // ") " $strPhone = $strPhone.substr($strTemp,3,3); // Exchange $strPhone = $strPhone."-"; // "-" $strPhone = $strPhone.substr($strTemp,(strlen($strTemp) - 4)); // 4 digit part } else { $strPhone = "NOT_VALID"; } //end if return $strPhone; } //end function //=============================================================================================================================== function add_space($theString) { $function_ret = str_replace("_"," ",$theString); return $function_ret; } //end function //=============================================================================================================================== function set_non_blank_spaces($theString) { $function_ret=str_replace("~"," ",$theString); return $function_ret; } //end function //=============================================================================================================================== function str_to_array($keystring="",$valuestring="") { $keys = explode(",",$keystring); $values = explode(",",$valuestring); for ($i=0; $i < count($keys); $i++) { $key = $keys[$i]; $newarray[$key] = $values[$i]; } // next return $newarray; }// end function //=============================================================================================================================== function form_clean($data) { //inserts the "\n" for each carriage return $data = nl2br($data); $data = stripslashes($data); //$cr = chr(13); //$br = "\n"; //$data = str_replace($br, $cr, $data); return $data; } //END FUNCTION //=============================================================================================================================== function build_states_array() { global $states_array; $states_array = array("AL" => "Alabama", "AK" => "Alaska", "AZ" => "Arizona", "AR" => "Arkansas", "CA" => "California", "CO" => "Colorado", "CT" => "Connecticut", "DE" => "Delaware", "FL" => "Florida", "GA" => "Georgia", "HI" => "Hawaii", "ID" => "Idaho", "IL" => "Illinois", "IN" => "Indiana", "IA" => "Iowa", "KS" => "Kansas", "KY" => "Kentucky", "LA" => "Louisiana", "ME" => "Maine", "MD" => "Maryland", "MA" => "Massachusetts", "MI" => "Michigan", "MN" => "Minnesota", "MS" => "Mississippi", "MO" => "Missouri", "MT" => "Montana", "NE" => "Nebraska", "NV" => "Nevada", "NH" => "New Hampshire", "NJ" => "New Jersey", "NM" => "New Mexico", "NY" => "New York", "NC" => "North Carolina", "ND" => "North Dakota", "OH" => "Ohio", "OK" => "Oklahoma", "OR" => "Oregon", "PA" => "Pennsylvania", "RI" => "Rhode Island", "SC" => "South Carolina", "SD" => "South Dakota", "TN" => "Tennessee", "TX" => "Texas", "UT" => "Utah", "VT" => "Vermont", "VA" => "Virginia", "WA" => "Washington", "WV" => "West Virginia", "WI" => "Wisconsin", "WY" => "Wyoming", ); } //END FUNCTION //=============================================================================================================================== ?>