// was the form submitted? Yes - fucking fantastic, let's do this thang! $formErrors = array(); $mailSent = false; $showThanks = false; if (isset($_POST["submitdate"]) && trim($_POST["submitdate"]) != '') { $fieldsToValidate = array( "business_name" => "Business Name", "your_name" => "Your Name", "contact_number" => "Contact Number", "email_address" => "Email Address", "based_in" => "where you are based in South Africa", "categories" => "Categories"/*, "code" => "Spam Prevention Code"*/); foreach ($fieldsToValidate as $fieldName => $fieldText) { if (!$_POST[$fieldName] || trim($_POST[$fieldName]) == "") $formErrors[] = " • Please specify ".$fieldText; } // any errors - can we proceed? if (count($formErrors) == 0) { //$mailcontent = "
"; $mailcontent = ""; $contactInfoArray = array( "Business Name" => $_POST["business_name"], "Name" => $_POST["your_name"], "Contact Number" => $_POST["contact_number"], "Province" => $_POST["based_in"], "Email Address" => $_POST["email_address"]." \n", "Website Address" => (($_POST["web_address"]) ? $_POST["web_address"] : "n/a") ); // add the contact details to the message //$mailcontent .= "CONTACT DETAILS
";
$mailcontent .= "CONTACT DETAILS".PHP_EOL;
foreach ($contactInfoArray as $key => $value)
{
if (trim($value) != "")
$mailcontent .= $key.": ".$value.PHP_EOL;;
// $mailcontent .= " ".$key.": ".$value."
";
}
//$mailcontent .= "
CATEGORY INFORMATION
";
//$mailcontent .= $_POST["categories"]."
TROU INSPIRASIE
";
// $mailcontent .= "Info Required: ".$_POST["include_trou_inspirasie_info"]."
TROU INSPIRASIE
";
// $mailcontent .= "Info Required: ".$_POST["include_trou_inspirasie_info"]."
COMMENTS / QUESTIONS / MESSAGE
";
//$mailcontent .= $_POST["your_message"]."
SERVER INFORMATION
";
$mailcontent .= PHP_EOL.PHP_EOL."SERVER INFORMATION".PHP_EOL;
// add the remote address
//$mailcontent .= " Remote Address: ".$_SERVER["REMOTE_ADDR"]."
";
$mailcontent .= "Remote Address: ".$_SERVER["REMOTE_ADDR"].PHP_EOL;
// add the date and time
$mailcontent .= "Date and Time: ".date("Y/m/d H:i:s").PHP_EOL;
//$mailcontent .= "";
// let's send the enquiry now - if successful send, record the enquiry against the SPs name
$mail = new PHPMailer();
try
{
$mail->IsHTML(false);
// who is it going to and who is it from
$mail->AddAddress("[email protected]", "Celebration Administrator");
$mail->AddBCC("[email protected]", "Celebration Manager");
// check if email address is incorrect - if so, use [email protected] and warn recipient
$emailValid = preg_match('/^(?:[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+@(?:(?:(?:[a-zA-Z0-9_](?:[a-zA-Z0-9_\-](?!\.)){0,61}[a-zA-Z0-9_-]?\.)+[a-zA-Z0-9_](?:[a-zA-Z0-9_\-](?!$)){0,61}[a-zA-Z0-9_]?)|(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\]))$/', $_POST["email_address"]);
if ($emailValid)
$mail->From = $_POST["email_address"];
else
{
$mail->From = "[email protected]";
$mailcontent = "IMPORTANT NOTICE: \n\nThe email address appears to be invalid. In order to send the mail, we have used a Celebration.co.za account to send from. Please DO NOT respond to this email and either correct the email address and / or contact the potential client directly. \n\n".$mailcontent;
}
$mail->FromName = $_POST["business_name"];
$mail->Subject = "Join Enquiry from Celebration.co.za";
// body text
$mail->Body = $mailcontent;
$mail->Mailer = "mail";
//$mail->Host = SMTP_HOST;
//$mail->SMTPAuth = SMTP_AUTH;
//$mail->Username = SMTP_USER;
//$mail->Password = SMTP_PASS;
//$mail->Port = 587;
// $mail->Encoding="7bit";
if ($mail->Send())
{
$mailSent = true;
$sql = "insert into join_enquiry (join_enquiry_id, join_enquiry_date, join_enquiry_business_name, join_enquiry_email_address, join_enquiry) values (null, current_date(), '".addslashes($_POST["business_name"])."', '".$_POST["email_address"]."', '".addslashes($mailcontent)."')";
$joinStmt = $dbh->prepare($sql);
if (!$joinStmt->execute())
mail('[email protected]', 'Failed Join Enquiry Insertion', $sql);
}
else
{
$formErrors[] = $mail->ErrorInfo;
}
}
catch (phpmailerException $e)
{
$formErrors[]=$e->errorMessage(); //Pretty error messages from PHPMailer
print_r($formErrors);
exit;
}
catch (Exception $e)
{
$formErrors[]=$e->getMessage(); //Boring error messages from anything else!
print_r($formErrors);
exit;
}
}
//}
}
?>
Get listed and have your business exposed to 1000s of brides across South Africa...
Celebration.co.za is the perfect solution to GROWING your wedding business online!
Celebration.co.za is a subsidiary of Mammoth Solutions, a Web design and Development company. Web design, web development and search engines are what we are all about and we take the necessary efforts to ensure our website gets found for both future bridal couples as well as potential wedding related service partner.
In order for your page to be setup on Celebration, we will require the following from you:
Contact us via email or give us a call and we will answer your questions as best we can! Alternatively, fill the join form on the right hand side of the page and make sure to include a list of your questions in the "Comments / Questions / Message" box.