# PHP Mail with Selection Box?

**URL:** <https://forum.kirupa.com/t/php-mail-with-selection-box/172352>\
**Category:** programming\
**Created:** [December 13, 2005, 4:34pm UTC](https://forum.kirupa.com/t/php-mail-with-selection-box/172352 "2005-12-13T16:34:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![VersusMG](https://avatars.discourse-cdn.com/v4/letter/v/898d66/32.png) [@VersusMG](https://forum.kirupa.com/u/VersusMG)\
**Post date:** [December 13, 2005, 4:34pm UTC](https://forum.kirupa.com/t/php-mail-with-selection-box/172352/1 "2005-12-13T16:34:01Z")

</div>

I am creating a contact form that has different subject options:

Sponsorship Information  
Member Information  
Marketing Information  
Sales and Advertising  
Website Question  
Other

What I need to happen is to have the message be sent to a different person depending on which selection is made.

This is what I tried…I just moves to the bottom ‘if’ statement and send to that address.

```php

<?php 
    
// get the variables from the URL request string 
$name = $_REQUEST['name']; 
$company = $_REQUEST['company']; 
$email = $_REQUEST['email']; 
$ssubject = $_REQUEST['subject']; 
$comments = $_REQUEST['comments']; 
 
// Variables for who's email it should go to: 
if($ssubject = "Sponsor Information") { 
   $mailto = "setha@comporium.net"; 
} 
if($ssubject = "Member Information") { 
   $mailto = "saldridge@yeacharlotte.org"; 
} 
if($ssubject = "Marketing Information") { 
   $mailto = "seth@sethaldridge.com"; 
} 
else($mailto = "setha@comporium.net"); 
 
// Send the email to me! 
$to = "$mailto"; 
$subject = "$ssubject"; 
$body = "The following is a message from YEA Charlotte's website.

Name: $name
Company: $company
Email: $email

Comments: $comments

Please respond to this message as soon as possible.

Thank you,
Admin
www.YEACharlotte.org"; 
$from = "FROM: $email"; 
$response = mail($to, $subject, $body, $from); 
 
// If the email successfully sends go to header, else show message!  
if($response) 
{ 
   header("location: http://www.yeacharlotte.org/contacts.html"); 
} 
else 
{ 
   echo("Message was not able to send!"); 
} 
 
?>

```
