# Trouble with Formit &emailTo and Dropdown Selection

**URL:** <https://community.modx.com/t/trouble-with-formit-emailto-and-dropdown-selection/7062>\
**Category:** Extras\
**Created:** [September 19, 2023, 2:36pm UTC](https://community.modx.com/t/trouble-with-formit-emailto-and-dropdown-selection/7062 "2023-09-19T14:36:17Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![carlo\_13](https://community.modx.com/user_avatar/community.modx.com/carlo_13/32/2751_2.png) [@carlo\_13](https://community.modx.com/u/carlo_13)\
**Post date:** [September 19, 2023, 3:35pm UTC](https://community.modx.com/t/trouble-with-formit-emailto-and-dropdown-selection/7062/3 "2023-09-19T15:35:15Z")

</div>

Thank you for your reply.  
I’m going to try this snippet and see if it works

```auto
<?php
// Get the value of the recipient from the submitted form
$recipient = $hook->getValue('recipient');

// Set the email recipient based on the dropdown value
switch ($recipient) {
	case 'option1':
		$emailTo = 'one@example.com';
		break;
	case 'option2':
		$emailTo = 'two@example.com';
		break;
	case 'option3':
		$emailTo = 'three@example.com';
		break;
	default:
		$emailTo = 'other@example.com'; // Default email address
		break;
}

// Set the emailTo parameter for FormIt
$hook->formit->config['emailTo'] = $emailTo;

return true;

```

---

_[View the full topic](https://community.modx.com/t/trouble-with-formit-emailto-and-dropdown-selection/7062)._
