Forums

How to send email if DropDown item is selected

Ringette08 27 Aug, 2013
I'm trying to send an e-mail in the CC field to a person based upon the item that is selected in a dropbox.

If a specfic item is selected I need to have the email sent to a second person otherwise the CC field is left blank.

I added a Custom Code before the EMAIL in the On Submit section of the form.

The PHP code is as follows: (I took this from an earlier post)
<?php
  $form->data['cc_email'] = '';
if ( isset($form->data['checkbox_name']) && $form->data['checkbox_name'] ) {
  $form->data['cc_email'] = 'some_email@address.com';
}
?>

I replaced the first checkbox_name with the name of my Dropbox (LevelPlay_A)
and the second checkbox_name with the value I'm looking for (18+ Rec. League).

The [email]some_email@address.com[/email] was replaced with my e-mail.

I then placed {cc_mail} into the Dynamic CC field of my Email form..

This doesn't seem to work.

I'm guessing I need different PHP code for a DropBox.

Can anyone assist?

Kevin
GreyHead 28 Aug, 2013
Hi Ringette08,

I then placed {cc_mail} into the Dynamic CC field of my Email form.

Please try that without the {}

Bob
This topic is locked and no more replies can be posted.