Dynamic Recipient Form

**updated 2019-04-25  to reflect form id change in v4**

Ever wanted to send an email based on the department your user chooses in your web form? Well, you can with FormLoom.

In the sample code below we have created a Pop-up menu item ( labeled 'Department' ) in FormLoom and have given it the values Sales, Support and Info. Using the code below ( inserted into Page Inspector -> Code -> PHP Override Code ), combined with our pop-up menu, forms are now sent to different email addresses based on your user's choice.

//look at your form item in page look to determine it's item_number - # displayed at top of item in edit mode

switch($_POST['form']['item_X']) {
case "Sales" :
$mailer->settings['to'] = array("sales@userdomain.com"=>"Sales Dept.");
case "Support" :
$mailer->settings['to'] = array("support@userdomain.com"=>"Support Dept.");
default :
$mailer->settings['to'] = array("info@userdomain.com"=>"Info");

Of course you will need to modify this code to accommodate your unique setup, but it should not be too difficult. This is an ADVANCED feature and requires some knowledge of how PHP works. If you have any problems implementing this tip, then please use the forums to get help. It is not something we generally offer support on as it is unique to every user.

Have more questions? Submit a request


Article is closed for comments.
Powered by Zendesk