# Contact form, how to direct an e-mail to a selected department?

**URL:** <https://forum.kirupa.com/t/contact-form-how-to-direct-an-e-mail-to-a-selected-department/271543>\
**Category:** Uncategorized\
**Created:** [September 24, 2008, 2:57pm UTC](https://forum.kirupa.com/t/contact-form-how-to-direct-an-e-mail-to-a-selected-department/271543 "2008-09-24T14:57:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ian\_dcuk](https://avatars.discourse-cdn.com/v4/letter/i/ea666f/32.png) [@ian\_dcuk](https://forum.kirupa.com/u/ian_dcuk)\
**Post date:** [September 24, 2008, 2:57pm UTC](https://forum.kirupa.com/t/contact-form-how-to-direct-an-e-mail-to-a-selected-department/271543/1 "2008-09-24T14:57:26Z")

</div>

Is it possible so that a user can select a certain department in a list box in my contactus.html page and this can then be re-directed to a specified e-mail address?

Currently the department is sent as a subject to one e-mail account. But I would like this to be re-directed to the correct department/email address. Im guessing it’s got to do with changing the mail function somehow.

The contact.html can be found here: [http://www.suppleform.co.uk/pages/contactus.html](http://www.suppleform.co.uk/pages/contactus.html)

php code as follows:

\<?php  
$name = $\_POST[‘username’];  
$email = $\_POST[‘email’];  
$department = $\_POST[‘department’];  
$comment = $\_POST[‘comment’];  
//To, Subject, Message, Header  
mail(‘ian@myemail.co.uk’, ’ ’ . $department . ’ ', $comment, ‘From: ’ . $name . ’ \<’ . $email . ‘\>’);  
header(‘Location: contactusconfirmation.html’);

?\>

Any help would be must appreciated. :thumb:
