Your event checkbox value is set to:
value="<?php echo($rsEvents->getColumnVal("Title")); ?>, <?php echo($rsEvents->getColumnVal("Venue")); ?>, <?php echo date("l j F",strtotime($rsEvents->getColumnVal('Date')));?> <?php if ($rsEvents->getColumnVal("Mortgages") == 1) { ?>
MortgageEvent<?php } ?> <?php if ($rsEvents->getColumnVal("Protect") == 1) { ?>
ProtectionEvent<?php } ?> <?php if ($rsEvents->getColumnVal("Compliance") == 1) { ?>
ComplianceEvent<?php } ?>"
But your IF statement is checking if the value is "MortgageEvent"
It will never be that value, so that code would never run.
It looks like you have multiple checkboxes in a repeat region. What if more than one checkbox is checked? Would it send more than one email?
I think this code:
<?php if(isset($_POST['event']) && in_array("MortgageEvent",$_POST['event'])) { // send if Mortgage Event ?>
<?php
if (isset($_POST["submit"]) || isset($_POST["submit_x"])) { //WA Universal Email
$Email = new WA_Email("events_2");
$Email->Redirect = "?sent=true#success";
$Email->From = "your from";
$Email->addTo("your to");
$Email->BodyFile = "../webassist/email/event-registration.php";
if (function_exists("rel2abs") && $Email->Redirect) $Email->Redirect = $Email->Redirect?rel2abs($Email->Redirect,dirname(__FILE__)):"";
for ($emailGroup=0; $emailGroup<sizeof($Email->To); $emailGroup++) {
$Email->Subject = "Event Registration";
$Email->send($emailGroup);
}
$Email->close();
}
?>
<?php } // send if ?>
Maybe should be:
<?php if(isset($_POST['event'])) { // send if Mortgage Event ?>
<?php for ($x=0; $x<sizeof($_POST['event']); $x++) { // loop on checked boxes ?>
<?php
if (strpos($_POST['event'][$x],"MortgageEvent") !== false) { //WA Universal Email
$Email = new WA_Email("events_2");
$Email->From = "your from";
$Email->addTo("your to");
$Email->BodyFile = "../webassist/email/event-registration.php";
if (function_exists("rel2abs") && $Email->Redirect) $Email->Redirect = $Email->Redirect?rel2abs($Email->Redirect,dirname(__FILE__)):"";
for ($emailGroup=0; $emailGroup<sizeof($Email->To); $emailGroup++) {
$Email->Subject = "Event Registration";
$Email->send($emailGroup);
}
$Email->close();
}
?>
<?php } // loop on checked boxes
header("location: ?sent=true#success");
?>
<?php } // send if ?>