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 | 383 views | 7 replies

Ray BorduinWebAssist

Your event checkbox value is set to:

php:
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:
<?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:
<?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 ?>

Did this help? Tips are appreciated...

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...