Dynamic Recipient Form

**updated May 4, 2011 to reflect form id change in v2.0.4**

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($_SESSION['form']['item_X'])
{

     case "Sales" :
        $fl['to'] = array(array("name"=>"Sales Dept", "email"=>"sales@userdomain.com"));
    break;

    case "Support" :
        $fl['to'] = array(array("name"=>"Support Dept", "email"=>"support@userdomain.com"));
    break;

    default :
        $fl['to'] = array(array("name"=>"Info", "email"=>"info@userdomain.com"));
    break;

}

Of course you will need to modify this code to accomodate 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

0 Comments

Article is closed for comments.
Powered by Zendesk