title: PHP Mail Script Based on Dropdown Selection
body: <p>I have a script I acquired through here (Thanks Stack Overflow folks), and I wanted to modify it slightly to fit our specific application.</p>
  
  <p>Application: 
  We have an admin panel that I want to slip in a simple alerting form for when they need to reach all (or some) of our team based on severity.</p>
  
  <p>Minor - receives messages from all issues.
  Major - receives messages from some issues.
  Emergency - receives critical only messages.</p>
  
  <p>Basically, depending on what style of alerts the team member wants to receive, we place their email into the script under those specific sections. Usually, if they're under Minor, they're on all three. If they're under Emergency only, then that's the only thing they're under. We manually put them into the coding. (Unless someone knows how to code it to pull from an SQL database table, but that's okay)</p>
  
  <p>Here's the current script.</p>
  
  <pre class="lang-php prettyprint-override"><code>&lt;?php 
  if(isset($_POST['submit'])){
      $to = "";   // Receiving Email Address
      $headers = "From: alerts@domain.com" . "\r\n" .
  "BCC: " . $_POST['level'] . " ";
      $name = $_POST['name'];
      $subject = $_POST['subject'];
      $message = "From:" . $name . "\n\n" . $_POST['message'];
      mail($to,$subject,$message,$headers);
      echo "Mail Sent. Thank you ";
      // You can also use header('Location: thank_you.php'); to redirect to another page.
      }
  ?&gt;
  
  &lt;!DOCTYPE html&gt;
  &lt;style&gt;
  form {
      padding: 15px 0px 15px 10px;
  }
  &lt;/style&gt;
  &lt;head&gt;
  &lt;title&gt;KSI Alerts&lt;/title&gt;
  &lt;/head&gt;
      &lt;select name="level"&gt;
          &lt;option value=0 selected&gt;-Alert Level-&lt;/option&gt;
          &lt;option value='email1@domain.com,email2@domain.com' name="minor"&gt;Minor&lt;/option&gt;
          &lt;option value='email1@domain.com,email2@domain.com,email3@domain.com' name="major"&gt;Major&lt;/option&gt;
          &lt;option value='email1@domain.com,email2@domain.com,leaders@domain.com,all@domain.com' name="emergency"&gt;Emergency&lt;/option&gt;
           &lt;/select&gt; 
  &lt;body&gt;
  
  &lt;form action="?db=alertconfirm" method="post"&gt;
  Name: &lt;input type="text" name="name"&gt;&lt;br&gt;
  Summary: &lt;input type="text" name="subject"&gt;&lt;br&gt;
  &lt;!--Email: &lt;input type="text" name="email"&gt;&lt;br&gt; --&gt;
  Message:&lt;br&gt;&lt;textarea rows="5" name="message" cols="30"&gt;&lt;/textarea&gt;&lt;br&gt;
  &lt;input type="submit" name="submit" value="Submit"&gt;
  &lt;/form&gt;
  
  &lt;/body&gt;
  &lt;/html&gt; 
  </code></pre>