# Adding A Drop Down Email Address Recipient to A Contact Form

**URL:** <https://www.phphelp.com/t/adding-a-drop-down-email-address-recipient-to-a-contact-form/11807>\
**Category:** General PHP Help\
**Created:** [September 2, 2010, 8:37pm UTC](https://www.phphelp.com/t/adding-a-drop-down-email-address-recipient-to-a-contact-form/11807 "2010-09-02T20:37:31Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![macrat101](https://www.phphelp.com/letter_avatar_proxy/v4/letter/m/cdc98d/32.png) [@macrat101](https://www.phphelp.com/u/macrat101)\
**Post date:** [September 2, 2010, 8:37pm UTC](https://www.phphelp.com/t/adding-a-drop-down-email-address-recipient-to-a-contact-form/11807/1 "2010-09-02T20:37:31Z")

</div>

[font=verdana][size=medium]I have a contact form that works perfectly … the forms results are currently being sent to one email address.

There is a drop down “Contact” field on the form, and I would like the forms results to be sent to the persons email address selected from the drop down.

The php lines are $Contact = $\_POST[“Contact”]; and $msg .= “Contact: $Contact\n”;

Drop Down Names Drop Down Email Addresses  
Keith [keith@xyz.com](mailto:keith@xyz.com)  
John [john@xyz.com](mailto:john@xyz.com)  
Mike [mike@xyz.com](mailto:mike@xyz.com)

Would someone please copy the entire php script below, and paste it into a reply with the drop down names selection function added?

There’s a mail headers & mail section at the very bottom, and I think possibly adding another mail header, that references the drop down selection field “Contact” might be close, but honestly I don’t have a clue as to what I’m doing.

I can spend all day on this, and still not get it right. However, if I can see how it’s written … I can add the rest email addresses which I didn’t list above.

Thank You![/size][size=18px]

* * *

[/size][/font][size=small][php][font=verdana][/size][size=18px]\<?php$d = date(“m-d-y H:i:s”);// assign incomming data$CustomerStatus = $\_POST[“CustomerStatus”];$Contact = $\_POST[“Contact”];$Name = $\_POST[“Name”];$an = str\_replace(" ", “”, $Name);$Company = $\_POST[“Company”];$Phone = $\_POST[“Phone”];//$office = $\_POST[“office”];$Fax = $\_POST[“Fax”];$Email = $\_POST[“Email”];$ProjectName = $\_POST[“ProjectName”];$ProofType = $\_POST[“ProofType”];$Pages = $\_POST[“Pages”];$Quantity = $\_POST[“Quantity”];$ColorFrontBack = $\_POST[“ColorFrontBack”];$FlatSize = $\_POST[“FlatSize”];$FoldedSize = $\_POST[“FoldedSize”];$StockText = $\_POST[“StockText”];$StockCover = $\_POST[“StockCover”];$LabelStock = $\_POST[“LabelStock”];$Coating = $\_POST[“Coating”];$Bindery = $\_POST[“Bindery”];$Additional = $\_POST[“Additional”];$FileType = $\_POST[“FileType”];$ApplicationType = $\_POST[“ApplicationType”];$group1 = $\_POST[“group1”];$group2 = $\_POST[“group2”];$group3 = $\_POST[“group3”];$redirect = $\_POST[“redirect”]; [/size][/font][/php][/size][size=small]// [http://www.mysite.com/](http://www.mysite.com/)  
//$subject = $\_POST[“Subject”]; [/size][size=small]// Subject is hard coded in the config area, you can use either, comment out the one you dont want to use

/\* \*\*\*\*\*\*\*\*\*\*\*\*\* Begin Configuration \*\*\*\*\*\*\*\*\*\*\*\*\* \*/  
$relocate = “[http://www](http://www). [mysite.com/](http://mysite.com/)”; // insert your relocation url here  
$home = “[http://www](http://www). [mysitehome.com/](http://mysitehome.com/)”;  
$MOVE\_TO\_PATH = ‘/home/content/x/y/x/xyzaaa/html/FileUpload/’;  
$PATH\_TO\_DIR = ‘[http://www](http://www). [mysitehome.com/FileUpload/](http://mysitehome.com/FileUpload/)’;  
// The following values are used to verify\_uploaded\_file() as the sizes and types that can be uploaded.  
$UPLOAD\_TYPES[‘PSD’] = 1; // Allow .psd files  
$UPLOAD\_TYPES[‘JPG’] = 1; // Allow .jpg files (definition must be upper case)  
$UPLOAD\_TYPES[‘JPEG’] = 1; // Allow .jpeg files  
$UPLOAD\_TYPES[‘AI’] = 1; // Allow .ai files  
$UPLOAD\_TYPES[‘EPS’] = 1; // Allow .eps files  
$UPLOAD\_TYPES[‘PDF’] = 1; // Allow .pdf files  
$UPLOAD\_TYPES[‘GIF’] = 1; // Allow .gif files  
$UPLOAD\_TYPES[‘PNG’] = 1; // Allow .png files  
$UPLOAD\_TYPES[‘DOC’] = 1; // Allow .doc files  
$UPLOAD\_TYPES[‘XLS’] = 1; // Allow .xls files  
$UPLOAD\_TYPES[‘ZIP’] = 1; // Allow .zip files  
$UPLOAD\_TYPES[‘SIT’] = 1; // Allow .sit files  
$UPLOAD\_TYPES[‘FLA’] = 1; // Allow .fla files  
$UPLOAD\_SIZES[‘max’] = 180000000; // Maximum size – Make sure the file is under 180 MB : 180,000,000 = 180 MB  
$UPLOAD\_SIZES[‘min’] = 0; // Minimum size – Arbitrary small file size to distinguish between no file and file submission

$sender\_name = “My Site Order”;  
$sender\_email = "support@mysitehome.com";  
$mailheaders = “Content-Type: text/plain; charset=us-ascii\nFrom: $sender\_name \<$sender\_email\>\nReply-To: \<$sender\_email\>\nReturn-Path: \<$sender\_email\>\nX-Mailer: PHP”;

//$to = “support@ [mysitehome.com](http://mysitehome.com)”;  
$to = “support@ [mysitehome.com](http://mysitehome.com)”;  
$subject = “Order”;

$msg ="$d\n\n";  
$msg .= “CustomerStatus: $CustomerStatus\n”;  
$msg .= “Contact: $Contact\n”;  
$msg .= “Name: $Name\n”;  
$msg .= “Company: $Company\n”;  
$msg .= “Phone: $Phone\n”;  
$msg .= “Fax: $Fax\n”;  
$msg .= “Email: $Email\n”;  
$msg .= “ProjectName: $ProjectName\n”;  
$msg .= “ProofType: $ProofType\n”;  
$msg .= “Pages: $Pages\n”;  
$msg .= “Quantity: $Quantity\n”;  
$msg .= “ColorFrontBack: $ColorFrontBack\n”;  
$msg .= “FlatSize: $FlatSize\n”;  
$msg .= “FoldedSize: $FoldedSize\n”;  
$msg .= “StockText: $StockText\n”;  
$msg .= “StockCover: $StockCover\n”;  
$msg .= “LabelStock: $LabelStock\n”;  
$msg .= “Coating: $Coating\n”;  
$msg .= “Bindery: $Bindery\n”;  
$msg .= “Additional: $Additional\n”;  
$msg .= “FileType: $FileType\n\n”;  
$msg .= “ApplicationType: $ApplicationType\n”;  
$msg .= “group1: $group1\n”;  
$msg .= “group2: $group2\n”;  
$msg .= “group3: $group3\n”;

$success\_block = “

Thank you for submitting your information. We will review your information and get back to you within a day or two.

  
  
”;

/\* \*\*\*\*\*\*\*\*\*\*\*\*\* End Configuration \*\*\*\*\*\*\*\*\*\*\*\*\* \*/

// fn to Check file size and type  
function verify\_uploaded\_file($strName, $intSize) {  
if ($intSize \< $GLOBALS[‘UPLOAD\_SIZES’][‘min’] || $intSize \> $GLOBALS[‘UPLOAD\_SIZES’][‘max’]) {  
return -1;  
}  
$arrSegments = split(’[.]’, $strName); // allow and check multiple dots in filename  
$strExtension = $arrSegments[count($arrSegments) - 1];  
if ($GLOBALS[‘UPLOAD\_TYPES’][strtoupper($strExtension)] != 1) {  
return -2; // File type not defined/allowed  
}  
return 1; // All tests have passed; this file is valid, return true  
} // end fn

function get\_extension($filename){  
$arrSegments = split(’[.]’, $filename);  
$extension = $arrSegments[count($arrSegments) - 1];  
return $extension;  
}

$head0 = "

 Image Upload 
  
  
";

$head1 = "

\n \n \n\n \n \n 

| **Image Upload** |
| ";

$head2 = "

 |

";

// echo $head0;  
// echo $head1;

/\* begin file upload work \*/

if ($HTTP\_POST\_FILES[‘upload\_file1’][‘name’] != “”) {

//echo 'File 1: ’ . $HTTP\_POST\_FILES[‘upload\_file1’][‘name’] . ‘’ . ‘  
Size: ’ . $HTTP\_POST\_FILES[‘upload\_file1’][‘size’] . ‘  
’;  
$intResult = verify\_uploaded\_file($HTTP\_POST\_FILES[‘upload\_file1’][‘name’], $HTTP\_POST\_FILES[‘upload\_file1’][‘size’]);  
if ($intResult != 1) {  
$msg\_base = $HTTP\_POST\_FILES[‘upload\_file1’][‘name’] . ’ is unacceptable.

’;  
if ($intResult == -1) {  
$send = “false”;  
die($msg\_base . ‘Reason: File size is too large or non-existent. Please use your Back button to try again.

’);  
} elseif ($intResult == -2) {  
$send = “false”;  
die($msg\_base . ‘Reason: File type is not allowed. Please use your Back button to try again.

’);  
}  
}

if (! move\_uploaded\_file($HTTP\_POST\_FILES[‘upload\_file1’][‘tmp\_name’], $MOVE\_TO\_PATH . $HTTP\_POST\_FILES[‘upload\_file1’][‘name’]) ) {  
$send = “false”;  
die(‘You did not upload a file or the file could not be moved to ’ . $MOVE\_TO\_PATH . $HTTP\_POST\_FILES[‘upload\_file1’][‘name’]);  
} else {  
$ext = get\_extension($HTTP\_POST\_FILES[‘upload\_file1’][‘name’]);  
$newname = “$an” . “-1” . “.$ext”;  
rename ($MOVE\_TO\_PATH . $HTTP\_POST\_FILES[‘upload\_file1’][‘name’],$MOVE\_TO\_PATH . $newname);  
$msg .= “$PATH\_TO\_DIR” . “$newname\n”;  
//echo ‘

’ . $HTTP\_POST\_FILES[‘upload\_file1’][‘name’] . ’ was successfully uploaded.

\<a href=’ . $PATH\_TO\_DIR . $newname . ’ target="\_blank"\>View File #1 Here

’;  
$send = “true”;  
}

} else {  
//echo “No attempt to upload file #1  
\n\n”;  
} // end check file requirements

if ($HTTP\_POST\_FILES[‘upload\_file2’][‘name’] != “”) {  
//echo '

File 2: ’ . $HTTP\_POST\_FILES[‘upload\_file2’][‘name’] . ‘’ . ‘  
Size: ’ . $HTTP\_POST\_FILES[‘upload\_file2’][‘size’] . ‘  
’;  
$intResult = verify\_uploaded\_file($HTTP\_POST\_FILES[‘upload\_file2’][‘name’], $HTTP\_POST\_FILES[‘upload\_file2’][‘size’]);  
if ($intResult != 1) {  
$msg\_base = $HTTP\_POST\_FILES[‘upload\_file2’][‘name’] . ’ is unacceptable.

’;  
if ($intResult == -1) {  
$send = “false”;  
die($msg\_base . ‘Reason: File size is too large or non-existent. Please use your Back button to try again.

’);  
} elseif ($intResult == -2) {  
$send = “false”;  
die($msg\_base . ‘Reason: File type is not allowed. Please use your Back button to try again.

’);  
}  
}

if (! move\_uploaded\_file($HTTP\_POST\_FILES[‘upload\_file2’][‘tmp\_name’], $MOVE\_TO\_PATH . $HTTP\_POST\_FILES[‘upload\_file2’][‘name’]) ) {  
$send = “false”;  
die(‘You did not upload a file or the file could not be moved to ’ . $MOVE\_TO\_PATH . $HTTP\_POST\_FILES[‘upload\_file2’][‘name’]);  
} else {  
$ext = get\_extension($HTTP\_POST\_FILES[‘upload\_file2’][‘name’]);  
$newname2 = “$an” . “-2” . “.$ext”;  
rename ($MOVE\_TO\_PATH . $HTTP\_POST\_FILES[‘upload\_file2’][‘name’],$MOVE\_TO\_PATH . $newname2);  
$msg .= “$PATH\_TO\_DIR” . “$newname2\n”;  
//echo ‘

’ . $HTTP\_POST\_FILES[‘upload\_file2’][‘name’] . ’ was successfully uploaded.

\<a href=’ . $PATH\_TO\_DIR . $newname2 . ’ target="\_blank"\>View File #2 Here

’;  
$send = “true”;  
}

} else {  
//echo “No attempt to upload file #2  
\n\n”;  
} // end check file requirements

if ($HTTP\_POST\_FILES[‘upload\_file3’][‘name’] != “”) {  
//echo '

File 3: ’ . $HTTP\_POST\_FILES[‘upload\_file3’][‘name’] . ‘’ . ‘  
Size: ’ . $HTTP\_POST\_FILES[‘upload\_file3’][‘size’] . ‘  
’;  
$intResult = verify\_uploaded\_file($HTTP\_POST\_FILES[‘upload\_file3’][‘name’], $HTTP\_POST\_FILES[‘upload\_file3’][‘size’]);  
if ($intResult != 1) {  
$msg\_base = $HTTP\_POST\_FILES[‘upload\_file3’][‘name’] . ’ is unacceptable.

’;  
if ($intResult == -1) {  
$send = “false”;  
die($msg\_base . ‘Reason: File size is too large or non-existent. Please use your Back button to try again.

’);  
} elseif ($intResult == -2) {  
$send = “false”;  
die($msg\_base . ‘Reason: File type is not allowed. Please use your Back button to try again.

’);  
}  
}

if (! move\_uploaded\_file($HTTP\_POST\_FILES[‘upload\_file3’][‘tmp\_name’], $MOVE\_TO\_PATH . $HTTP\_POST\_FILES[‘upload\_file3’][‘name’]) ) {  
$send = “false”;  
die(‘You did not upload a file or the file could not be moved to ’ . $MOVE\_TO\_PATH . $HTTP\_POST\_FILES[‘upload\_file3’][‘name’]);  
} else {  
$ext = get\_extension($HTTP\_POST\_FILES[‘upload\_file3’][‘name’]);  
$newname3 = “$an” . “-3” . “.$ext”;  
rename ($MOVE\_TO\_PATH . $HTTP\_POST\_FILES[‘upload\_file3’][‘name’],$MOVE\_TO\_PATH . $newname3);  
$msg .= “$PATH\_TO\_DIR” . “$newname3\n”;  
//echo ‘

’ . $HTTP\_POST\_FILES[‘upload\_file3’][‘name’] . ’ was successfully uploaded.

\<a href=’ . $PATH\_TO\_DIR . $newname3 . ’ target="\_blank"\>View File #3 Here

’;  
$send = “true”;  
}

} else {  
//echo “No attempt to upload file #3  
\n\n”;  
} // end check file requirements

if ($HTTP\_POST\_FILES[‘upload\_file4’][‘name’] != “”) {  
//echo '

File 4: ’ . $HTTP\_POST\_FILES[‘upload\_file4’][‘name’] . ‘’ . ‘  
Size: ’ . $HTTP\_POST\_FILES[‘upload\_file4’][‘size’] . ‘  
’;  
$intResult = verify\_uploaded\_file($HTTP\_POST\_FILES[‘upload\_file4’][‘name’], $HTTP\_POST\_FILES[‘upload\_file4’][‘size’]);  
if ($intResult != 1) {  
$msg\_base = $HTTP\_POST\_FILES[‘upload\_file4’][‘name’] . ’ is unacceptable.

’;  
if ($intResult == -1) {  
$send = “false”;  
die($msg\_base . ‘Reason: File size is too large or non-existent. Please use your Back button to try again.

’);  
} elseif ($intResult == -2) {  
$send = “false”;  
die($msg\_base . ‘Reason: File type is not allowed. Please use your Back button to try again.

’);  
}  
}

if (! move\_uploaded\_file($HTTP\_POST\_FILES[‘upload\_file4’][‘tmp\_name’], $MOVE\_TO\_PATH . $HTTP\_POST\_FILES[‘upload\_file4’][‘name’]) ) {  
$send = “false”;  
die(‘You did not upload a file or the file could not be moved to ’ . $MOVE\_TO\_PATH . $HTTP\_POST\_FILES[‘upload\_file4’][‘name’]);  
} else {  
$ext = get\_extension($HTTP\_POST\_FILES[‘upload\_file4’][‘name’]);  
$newname4 = “$an” . “-4” . “.$ext”;  
rename ($MOVE\_TO\_PATH . $HTTP\_POST\_FILES[‘upload\_file4’][‘name’],$MOVE\_TO\_PATH . $newname4);  
$msg .= “$PATH\_TO\_DIR” . “$newname4\n”;  
//echo ‘

’ . $HTTP\_POST\_FILES[‘upload\_file4’][‘name’] . ’ was successfully uploaded.

\<a href=’ . $PATH\_TO\_DIR . $newname4 . ’ target="\_blank"\>View File #4 Here

’;  
$send = “true”;  
}

} else {  
//echo “No attempt to upload file #4  
\n\n”;  
} // end check file requirements

if ($HTTP\_POST\_FILES[‘upload\_file5’][‘name’] != “”) {  
//echo '

File 5: ’ . $HTTP\_POST\_FILES[‘upload\_file5’][‘name’] . ‘’ . ‘  
Size: ’ . $HTTP\_POST\_FILES[‘upload\_file5’][‘size’] . ‘  
’;  
$intResult = verify\_uploaded\_file($HTTP\_POST\_FILES[‘upload\_file5’][‘name’], $HTTP\_POST\_FILES[‘upload\_file5’][‘size’]);  
if ($intResult != 1) {  
$msg\_base = $HTTP\_POST\_FILES[‘upload\_file5’][‘name’] . ’ is unacceptable.

’;  
if ($intResult == -1) {  
$send = “false”;  
die($msg\_base . ‘Reason: File size is too large or non-existent. Please use your Back button to try again.

’);  
} elseif ($intResult == -2) {  
$send = “false”;  
die($msg\_base . ‘Reason: File type is not allowed. Please use your Back button to try again.

’);  
}  
}

if (! move\_uploaded\_file($HTTP\_POST\_FILES[‘upload\_file5’][‘tmp\_name’], $MOVE\_TO\_PATH . $HTTP\_POST\_FILES[‘upload\_file5’][‘name’]) ) {  
$send = “false”;  
die(‘You did not upload a file or the file could not be moved to ’ . $MOVE\_TO\_PATH . $HTTP\_POST\_FILES[‘upload\_file5’][‘name’]);  
} else {  
$ext = get\_extension($HTTP\_POST\_FILES[‘upload\_file5’][‘name’]);  
$newname5 = “$an” . “-5” . “.$ext”;  
rename ($MOVE\_TO\_PATH . $HTTP\_POST\_FILES[‘upload\_file5’][‘name’],$MOVE\_TO\_PATH . $newname5);  
$msg .= “$PATH\_TO\_DIR” . “$newname5\n”;  
// echo ‘

’ . $HTTP\_POST\_FILES[‘upload\_file5’][‘name’] . ’ was successfully uploaded.

\<a href=’ . $PATH\_TO\_DIR . $newname5 . ’ target="\_blank"\>View File #5 Here

’;  
$send = “true”;  
}

} else {  
//echo “No attempt to upload file #5  
\n\n”;  
} // end check file requirements

if ($HTTP\_POST\_FILES[‘upload\_file6’][‘name’] != “”) {  
//echo '

File 6: ’ . $HTTP\_POST\_FILES[‘upload\_file6’][‘name’] . ‘’ . ‘  
Size: ’ . $HTTP\_POST\_FILES[‘upload\_file6’][‘size’] . ‘  
’;  
$intResult = verify\_uploaded\_file($HTTP\_POST\_FILES[‘upload\_file6’][‘name’], $HTTP\_POST\_FILES[‘upload\_file6’][‘size’]);  
if ($intResult != 1) {  
$msg\_base = $HTTP\_POST\_FILES[‘upload\_file6’][‘name’] . ’ is unacceptable.

’;  
if ($intResult == -1) {  
$send = “false”;  
die($msg\_base . ‘Reason: File size is too large or non-existent. Please use your Back button to try again.

’);  
} elseif ($intResult == -2) {  
$send = “false”;  
die($msg\_base . ‘Reason: File type is not allowed. Please use your Back button to try again.

’);  
}  
}

if (! move\_uploaded\_file($HTTP\_POST\_FILES[‘upload\_file6’][‘tmp\_name’], $MOVE\_TO\_PATH . $HTTP\_POST\_FILES[‘upload\_file6’][‘name’]) ) {  
$send = “false”;  
die(‘You did not upload a file or the file could not be moved to ’ . $MOVE\_TO\_PATH . $HTTP\_POST\_FILES[‘upload\_file6’][‘name’]);  
} else {  
$ext = get\_extension($HTTP\_POST\_FILES[‘upload\_file6’][‘name’]);  
$newname6 = “$an” . “-6” . “.$ext”;  
rename ($MOVE\_TO\_PATH . $HTTP\_POST\_FILES[‘upload\_file6’][‘name’],$MOVE\_TO\_PATH . $newname6);  
$msg .= “$PATH\_TO\_DIR” . “$newname6\n”;  
// echo ‘

’ . $HTTP\_POST\_FILES[‘upload\_file6’][‘name’] . ’ was successfully uploaded.

\<a href=’ . $PATH\_TO\_DIR . $newname6 . ’ target="\_blank"\>View File #6 Here

’;  
$send = “true”;  
}

} else {  
//echo “No attempt to upload file #6  
\n\n”;  
} // end check file requirements

if ($HTTP\_POST\_FILES[‘upload\_file7’][‘name’] != “”) {  
//echo '

File 7: ’ . $HTTP\_POST\_FILES[‘upload\_file7’][‘name’] . ‘’ . ‘  
Size: ’ . $HTTP\_POST\_FILES[‘upload\_file7’][‘size’] . ‘  
’;  
$intResult = verify\_uploaded\_file($HTTP\_POST\_FILES[‘upload\_file7’][‘name’], $HTTP\_POST\_FILES[‘upload\_file7’][‘size’]);  
if ($intResult != 1) {  
$msg\_base = $HTTP\_POST\_FILES[‘upload\_file7’][‘name’] . ’ is unacceptable.

’;  
if ($intResult == -1) {  
$send = “false”;  
die($msg\_base . ‘Reason: File size is too large or non-existent. Please use your Back button to try again.

’);  
} elseif ($intResult == -2) {  
$send = “false”;  
die($msg\_base . ‘Reason: File type is not allowed. Please use your Back button to try again.

’);  
}  
}

if (! move\_uploaded\_file($HTTP\_POST\_FILES[‘upload\_file7’][‘tmp\_name’], $MOVE\_TO\_PATH . $HTTP\_POST\_FILES[‘upload\_file7’][‘name’]) ) {  
$send = “false”;  
die(‘You did not upload a file or the file could not be moved to ’ . $MOVE\_TO\_PATH . $HTTP\_POST\_FILES[‘upload\_file7’][‘name’]);  
} else {  
$ext = get\_extension($HTTP\_POST\_FILES[‘upload\_file7’][‘name’]);  
$newname7 = “$an” . “-7” . “.$ext”;  
rename ($MOVE\_TO\_PATH . $HTTP\_POST\_FILES[‘upload\_file7’][‘name’],$MOVE\_TO\_PATH . $newname7);  
$msg .= “$PATH\_TO\_DIR” . “$newname7\n”;  
// echo ‘

’ . $HTTP\_POST\_FILES[‘upload\_file7’][‘name’] . ’ was successfully uploaded.

\<a href=’ . $PATH\_TO\_DIR . $newname7 . ’ target="\_blank"\>View File #7 Here

’;  
$send = “true”;  
}

} else {  
//echo “No attempt to upload file #7  
\n\n”;  
} // end check file requirements

// echo “$success\_block”;  
//echo “

\<a href=“javascript: history.go(-1)”\>Back | Home”;

$my\_email = ‘support@mysitehome.com’;  
$mailheaders2 = “Content-Type: text/plain; charset=us-ascii\nFrom: My Printing Company \<$my\_email\>\nReply-To: \<$my\_email\>\nReturn-Path: \<$my\_email\>\nX-Mailer: PHP”;

if ($send != “false”) {  
mail($to, $subject, $msg, $mailheaders); // mail sent to admin  
mail($\_POST[‘Email’], $subject, ‘Thanks we received your info’,$mailheaders2); // confirmation email  
header(“Location: $relocate”);  
}

?\>  
[/size][size=small]

---

<div class="post-metadata">

**Author:** ![macrat101](https://www.phphelp.com/letter_avatar_proxy/v4/letter/m/cdc98d/32.png) [@macrat101](https://www.phphelp.com/u/macrat101)\
**Post date:** [September 2, 2010, 8:44pm UTC](https://www.phphelp.com/t/adding-a-drop-down-email-address-recipient-to-a-contact-form/11807/2 "2010-09-02T20:44:02Z")

</div>

Thanks!

---

<div class="post-metadata">

**Author:** ![phphelp](https://www.phphelp.com/letter_avatar_proxy/v4/letter/p/3ec8ea/32.png) [@phphelp](https://www.phphelp.com/u/phphelp)\
**Post date:** [September 2, 2010, 8:50pm UTC](https://www.phphelp.com/t/adding-a-drop-down-email-address-recipient-to-a-contact-form/11807/3 "2010-09-02T20:50:42Z")

</div>

If you use “php” button in the toolbar to format php code, your code would look like this:  
[php]\<?php  
echo ‘Hello World!’;  
?\>[/php]

---

<div class="post-metadata">

**Author:** ![phphelp](https://www.phphelp.com/letter_avatar_proxy/v4/letter/p/3ec8ea/32.png) [@phphelp](https://www.phphelp.com/u/phphelp)\
**Post date:** [September 2, 2010, 8:59pm UTC](https://www.phphelp.com/t/adding-a-drop-down-email-address-recipient-to-a-contact-form/11807/4 "2010-09-02T20:59:15Z")

</div>

Add this code to your html form:

[php]Contact:

Keith John Mike [/php]

And then modify this line in your php code:  
[php]$to = “support@ [mysitehome.com](http://mysitehome.com)”;[/php]

to this:  
[php]$to = $\_POST[“to”];  
if(!in\_array(array("keith@xyz.com","john@xyz.com","mike@xyz.com"))) $to = "support@mysitehome.com"’;[/php]

---

<div class="post-metadata">

**Author:** ![macrat101](https://www.phphelp.com/letter_avatar_proxy/v4/letter/m/cdc98d/32.png) [@macrat101](https://www.phphelp.com/u/macrat101)\
**Post date:** [September 2, 2010, 9:33pm UTC](https://www.phphelp.com/t/adding-a-drop-down-email-address-recipient-to-a-contact-form/11807/5 "2010-09-02T21:33:32Z")

</div>

When I added

[font=courier new][size=13px]$to [/size][/font]= $\_POST[“to”];  
if(!in\_array(array("keith@xyz.com","john@xyz.com","mike@xyz.com"))) $to = "support@mysitehome.com"’;

[size=13px][font=arial]I get this error:[/font][/size]  
[font=arial][/font]  
[font=arial][size=13px][font=Times][/size][size=medium]Parse error[/size][/font][/size][size=13px][font=Times][/size][size=medium]: syntax error, unexpected T\_CONSTANT\_ENCAPSED\_STRING in[/size][/font][/size][size=13px][font=Times][/size][size=medium] [/size][/font][font=Times][/size][size=medium]/home/content/v/n/d/vndink/html/UP/orders.php[/size][/font][font=Times][/size][size=medium] [/size][/font][font=Times][/size][size=medium]on line[/size][/font][font=Times][/size][size=medium] [/size][/font][font=Times][/size][size=medium]106[/size][/font][/font][font=times][font=arial][/size][size=medium][/font][/font]  
Line 106 is

if ($intSize \< $GLOBALS[‘UPLOAD\_SIZES’][‘min’] || $intSize \> $GLOBALS[‘UPLOAD\_SIZES’][‘max’]) {

Thanks

---

<div class="post-metadata">

**Author:** ![phphelp](https://www.phphelp.com/letter_avatar_proxy/v4/letter/p/3ec8ea/32.png) [@phphelp](https://www.phphelp.com/u/phphelp)\
**Post date:** [September 2, 2010, 9:48pm UTC](https://www.phphelp.com/t/adding-a-drop-down-email-address-recipient-to-a-contact-form/11807/6 "2010-09-02T21:48:51Z")

</div>

There is extra apostrophe at the end of line, I mistyped.

p.s. Something is wrong with your formatting. Try to switch to text mode when entering your text/code (in the toolbar of edit box - there is a button with arrow at right - “Toggle View”

---

<div class="post-metadata">

**Author:** ![macrat101](https://www.phphelp.com/letter_avatar_proxy/v4/letter/m/cdc98d/32.png) [@macrat101](https://www.phphelp.com/u/macrat101)\
**Post date:** [September 2, 2010, 10:02pm UTC](https://www.phphelp.com/t/adding-a-drop-down-email-address-recipient-to-a-contact-form/11807/7 "2010-09-02T22:02:11Z")

</div>

I removed the apostrophe, but am getting this error now

Warning: Wrong parameter count for in\_array() in /home/content/v/n/d/vndink/html/UP/orders.php on line 68

Warning: Cannot modify header information - headers already sent by (output started at /home/content/x/y/z/xyzaaa/html/UP/orders.php:68) in /home/content/x/y/z/xyzaaa/html/UP/orders.php on line 375

---

<div class="post-metadata">

**Author:** ![phphelp](https://www.phphelp.com/letter_avatar_proxy/v4/letter/p/3ec8ea/32.png) [@phphelp](https://www.phphelp.com/u/phphelp)\
**Post date:** [September 2, 2010, 10:22pm UTC](https://www.phphelp.com/t/adding-a-drop-down-email-address-recipient-to-a-contact-form/11807/8 "2010-09-02T22:22:54Z")

</div>

Sure! Missed variable that we want to match value in the array. Corrected code is below:

[php]$to = $\_POST[“to”];  
if(!in\_array($to,array("keith@xyz.com","john@xyz.com","mike@xyz.com"))) $to = "support@mysitehome.com";[/php]

---

<div class="post-metadata">

**Author:** ![macrat101](https://www.phphelp.com/letter_avatar_proxy/v4/letter/m/cdc98d/32.png) [@macrat101](https://www.phphelp.com/u/macrat101)\
**Post date:** [September 2, 2010, 10:47pm UTC](https://www.phphelp.com/t/adding-a-drop-down-email-address-recipient-to-a-contact-form/11807/9 "2010-09-02T22:47:01Z")

</div>

Woo Hoo … It Works! Thank You!

Last Question:

Never mind … I figured it out!
