close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Send an email only if a field contains a particular string

Thread began 5/20/2021 9:06 am by Mags | Last modified 5/21/2021 1:15 pm by Mags | 380 views | 7 replies

Mags

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.

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...