$formblock = " * Denotes a required field. "; if ($op != "ds") { // display form echo "$formblock"; } else if ($op == "ds") { $errArray = array(); if ($sender_fname == "") { $errArray[] = "First name"; $send = "no"; } if ($sender_lname == "") { $errArray[] = "Surname"; $send = "no"; } if(!preg_match ("/^.+@.+\..+/", "$sender_email")){ $errArray[] = "E-mail address"; $send = "no"; } if ($sender_subject == "") { $errArray[] = "Subject of Your Enquiry"; $send = "no"; } if ($sender_enquiry == "") { $errArray[] = "Your Enquiry"; $send = "no"; } if ($send != "no") { $submitted = "yes"; $to = "hospitality@sportsdays.co.uk"; #$to = "ray@pimdesign.com"; $subject = "$sender_subject"; $mailheaders = "From: $sender_email"; $msg = "Name: $sender_title $sender_fname $sender_lname\n\n"; $msg .="Company: $sender_company\n"; $msg .= "Address: $sender_address1,"; if ($sender_address2 != "") { $msg .= " $sender_address2,"; } if ($sender_address3 != "") { $msg .= " $sender_address3,"; } $msg .= " $sender_county, $sender_postcode\n"; $msg .="$sender_country\n"; $msg .="Subject of Enquiry: \n$sender_subject\n"; $msg .= "Enquiry: ".stripslashes($sender_enquiry)."\n"; $send_check=mail($to, $subject, $msg, $mailheaders); #mail($to, $subject, $msg); if ($send_check!=true) { echo 'An error occurred while sending mail.'; die(); } // Courtesy E-mail $to = "$sender_email"; $subject = "Your SportsDays Hospitality Enquiry"; $mailheaders = "From: hospitality@sportsdays.co.uk"; $replyMsg .= "Dear $sender_title $sender_lname,\n\n"; $replyMsg .= "Thank you for your enquiry.\n\nIt has been posted to our sales team where a consultant will be in contact with you shortly. However, if your requirement is of a more urgent nature, please call us on:\n\n"; $replyMsg .= " 01638 666 660\n\n"; $replyMsg .= "Kind regards,\n\n"; $replyMsg .= "SportsDays Hospitality Organisers\n"; $replyMsg .= "http://www.sportsdays.co.uk\n\n"; $send_check=mail($to, $subject, $msg, $mailheaders); #mail($to, $subject, $msg); if ($send_check!=true) { echo 'An error occurred while sending mail.'; die(); } echo "Enquiry Sent Thank you for your enquiry $sender_fname. Your details have been sent to our sales office. "; echo "We will get back to you shortly. If your enquiry is of a more urgent nature don't hesistate to call us on: 01638 666 660 There is no need to print this page as we have already sent you an e-mail containing this information. Thank you again for your enquiry, SportsDays.co.uk\n"; } else if ($send == "no") { $errMsg = "You didn't enter information for the following required field(s): "; $limit = (sizeof($errArray) - 2); $blanks = sizeof($errArray); if ($blanks >= 3) { for ($a = 0; $a < $limit; $a++) { $errMsg .= "$errArray[$a], "; } $a = $limit; $errMsg .= "$errArray[$a] and "; $a++; $errMsg .= "$errArray[$a]."; print "$errMsg \n $formblock"; } if ($blanks == 2) { print "$errMsg $errArray[0] and $errArray[1]. \n $formblock"; } if ($blanks == 1) { print "$errMsg $errArray[0]. \n $formblock"; } if ($blanks == 0) { print "Error: Didn't match any conditions: $limit"; } } } ?>
|