Forums

Field dependent emails

Galaxy83 08 May, 2013
Hello.

When a user submits a form, the system sends an email that contains all the fields.
But the Email field is not required. So when filling the form without the Email field I get this:

Name: John
Phone: 6546545646
Email:

What I would like to do is create emails that are dependant on the field's values:

Name: John
Phone: 6546545646
Email: NOT ENTERED

How can I do that?
GreyHead 08 May, 2013
Hi Galaxy83,

You can add a Custom Code action before the Email action and add:
<?php
if ( !isset($form->data['email']) || !$form->data['email'] ) {
  $form->data['email'] = '<b>Not entered</b>';
}
?>

Replace 'email' with the appropriate input name.

Bob
Galaxy83 08 May, 2013
Thank you Bob. Works great!
This topic is locked and no more replies can be posted.