Send an email only if a field contains a particular string
Hi Ray, I have a dynamically populated form which sends an email when submitted. The form has a repeating checkbox field with a list of events, which have three possible categories. I want to send the email to different people depending on which categor(ies) the event comes under. I think the simplest way is to include a particular text string in the checkbox value field which will show depending on which categories the event comes under, then surround the email code with an IF statement. I've got this far but I think my IF statement is wrong:
<?php if(isset($_POST['event']) && preg_match("EventType1", $_POST['event'])) { ?>
(email code in here)
<?php } ?>
The checkbox field looks like this:
<input name="event[]" type="checkbox" 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("EventType1") == 1) { ?>
EventType1<?php } ?> <?php if ($rsEvents->getColumnVal("EventType2") == 1) { ?>
EventType2<?php } ?> <?php if ($rsEvents->getColumnVal("EventType3") == 1) { ?>
EventType1<?php } ?>">
I can see in Chrome Inspector that the checkbox value is displaying correctly, but my email doesn't send.