This file is a PHP file; please change the filename to contact-form.php before you upload it to your web server in order for it to work. This file is open source, provided by the developers of ITCN NJ Web Design and Marketing, http://www.itcn.com
Version 1.0, April 2008

PAGE HEADER CONTENT

Put whatever webpage content you want before the form here.

PAGE FOOTER CONTENT

Any content here will be displayed after the contact form.

$y){ $finalValue = $x; if (strstr($finalValue, "form_")) { if (strstr($finalValue, "form_req_")) { // GET REQUIRED FIELDS $finalValue = str_replace("form_req_", "", $finalValue); $finalValue = str_replace("_", " ", $finalValue); if (strlen($y) < 1) { $formError .= "
  • The $finalValue field is required."; } else { $finalResult .= "
  • $finalValue: $y
  • \n"; } } else { if (is_array($y)) { // BUILD ARRAY FOR RADIOBUTTONS $finalResult .= "
  • $finalValue: "; foreach($y as $arrayValues) { $finalResult .= $arrayValues . ", "; } $finalResult .= "
  • \n"; } else { $finalValue = str_replace("form_", "", $finalValue); $finalValue = str_replace("_", " ", $finalValue); $finalResult .= "
  • $finalValue: $y
  • \n"; } } } } } if (strlen($formError) < 1 && strlen($finalResult) > 1) { // THIS IS THE ACTUAL EMAIL CODE, YOU MAY CUSTOMIZE THIS IF YOU WISH $mailheaders = "MIME-Version: 1.0\r\n"; $mailheaders .= "Content-type: text/html; charset=iso-8859-1\r\n"; $mailheaders .= "X-Originating-IP: " . gethostbyname(getenv("REMOTE_ADDR")) . "\r\n"; $mailheaders .= "From: $yourFromEmail\r\n"; $mailBody = "\n"; $mailBody .= "

    This form was submitted from the website.

    \n"; // NOW ACTUALLY SEND OUT THE EMAIL mail($yourToEmail, "Your Website Contact Form Submission", $mailBody, $mailheaders); $mailheaders = "MIME-Version: 1.0\r\n"; $mailheaders .= "Content-type: text/html; charset=iso-8859-1\r\n"; $mailheaders .= "X-Originating-IP: " . gethostbyname(getenv("REMOTE_ADDR")) . "\r\n"; $mailheaders .= "From: $yourFromEmail\r\n"; $mailBody = "

    Thank you. A website representative will be in touch with you shortly. Thank you for contacting us.

    "; // THIS WILL SEND AN EMAIL TO THE USER, LETTING THEM KNOW THAT THEIR FORM WAS SUCCESSFULLY SUBMITTED mail($_REQUEST["form_req_Email"], "Website Contact Us Form Submission", $mailBody, $mailheaders); displayThanks(); } else { echo "

    Sorry, but your form has the following errors: " . $formError . "

    "; displayForm(); } } function displayThanks() { echo "

    Thank you, " . $_REQUEST["form_req_Name"] . ", your form has been submitted and your request will be answered as soon as possible.

    "; } function displayForm() { // THIS IS THE ACTUAL HTML DISPLAY FORM. ADD AS MANY FORM ELEMENTS HERE AS YOU WISH, THEY WILL BE HANDLED AUTOMATICALLY ?>

    Name: " />

    Phone Number: " />

    Email Address: " />

    Preferred Method of Contact:
    Email
    Phone