title: Send email based on dropdown menu selection (mysql column update/status change)
body: <p>I'm looking to send an email whenever a different selection is posted to the database. </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;form action="&lt;?php echo htmlspecialchars(basename($_SERVER['REQUEST_URI'])); ?&gt;" method="post" enctype="multipart/form-data"&gt;
                      &lt;div class="form-group row &lt;?php echo (!empty($lotstatus_err)) ? 'has-error' : ''; ?&gt;"&gt;
                          &lt;div class="col-lg-4"&gt;
                                  &lt;label class="form-control-label"&gt;Status&lt;/label&gt;
                                  &lt;select class="form-control" value="&lt;?php echo $lotstatus; ?&gt;" id="lotstatus" name="lotstatus"&gt;
                                  &lt;option value="Executed"&gt;Executed&lt;/option&gt;
                                          &lt;option value="Not Interested" &lt;?php if($row["lotstatus"]=='Not Interested'){ echo "selected";} ?&gt;&gt;Not Interested&lt;/option&gt;
                                          &lt;option value="Hold" &lt;?php if($row["lotstatus"]=='Hold'){ echo "selected";} ?&gt;&gt;Hold&lt;/option&gt;
                                          &lt;option value="Title Ordered" &lt;?php if($row["lotstatus"]=='Title Ordered'){ echo "selected";} ?&gt;&gt;Title Ordered&lt;/option&gt;
                                          &lt;option value="Vetting" &lt;?php if($row["lotstatus"]=='Vetting'){ echo "selected";} ?&gt;&gt;Vetting&lt;/option&gt;
                                          &lt;option value="Survey Ordered" &lt;?php if($row["lotstatus"]=='Survey Ordered'){ echo "selected";} ?&gt;&gt;Survey Ordered&lt;/option&gt;
                                          &lt;option value="Lean Search Ordered" &lt;?php if($row["lotstatus"]=='Lean Search Ordered'){ echo "selected";} ?&gt;&gt;Lean Search Ordered&lt;/option&gt;
                                          &lt;option value="Clear to Closed" &lt;?php if($row["lotstatus"]=='Clear to Closed'){ echo "selected";} ?&gt;&gt;Clear to Closed&lt;/option&gt;
                                          &lt;option value="Closed" &lt;?php if($row["lotstatus"]=='Closed'){ echo "selected";} ?&gt;&gt;Closed&lt;/option&gt;
                                  &lt;/select&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>So, when a user updates the status, an email is sent out saying "this record was updated from 'previous status' to 'new status'. I have this under my prepared statement: </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>if(isset($_POST["lotstatus"]) &amp;&amp; !empty($_POST["lotstatus"])){ 
      $lotstatusPost = $_POST['lotstatus']; 
      $lotstatus = $row['lotstatus'];
      $streetnumber = $row['streetnumber'];
      $streetname = $row['streetname'];
  
      if($lotstatus != $lotstatusPost) {
          $email='al@gmail.com';
          $subject = "Lot Status Change";
          $message =$streetnumber. ' '. $streetname. ' '. 'Lot Status has changed from'.' '. $lotstatus. ' '. 'to'.' '. $lotstatusPost;
          $headers = "From: My Company"; 
          
          mail($email, $subject, $message, $headers); 
              //mail successfully sent
          
      }
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>No errors. It's just not sending. Or if I don't check if it isset, it sends when I land on the update page w/o the _POST field. 
  HELP!</p>