title: Multiple $_POST variable in a variable
body: <p>Hey I have this code that sends an email with some data sent by a form:</p>
  
  <pre><code>&lt;?php
  
    if (isset($_POST['submit'])) {
  
      error_reporting(E_NOTICE);
  
      function valid_email ($str) {
        return ( ! preg_match("/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix", $str)) ? FALSE : TRUE;
      }
  
      if ($_POST['name'] != '' &amp;&amp;  $_POST['email'] != '' &amp;&amp; $_POST['tel'] != '' &amp;&amp; valid_email($_POST['email']) == TRUE &amp;&amp; strlen($_POST['comment']) &gt; 1) {
  
        $to = preg_replace("([\r\n])", "", $_POST['receiver']);
        $from = preg_replace("([\r\n])", "", $_POST['name']);
        $subject = 'Online Message';
        $message = $_POST['comment'];
        $match = "/(bcc:|cc:|content\-type:)/i";
        if (preg_match($match, $to) || preg_match($match, $from) || preg_match($match, $message) || preg_match($match, $subject)) {
          die("Header injection detected.");
        }
  
        $headers = "From: \"".$_POST['name']."\" &lt;".$_POST['email']."&gt;\n";
        $headers .= "Reply-to: ".$_POST['email']."\r\n";
  
        if (mail($to, $subject, $message, $headers)) {
          echo 1; //SUCCESS
        } else {
          echo 2; //FAILURE - server failure
        }
  
      } else {
        echo 3; //FAILURE - not valid email
      }
  
    } else {
      die("Direct access not allowed!");
    }
  </code></pre>
  
  <p>I want to add the <code>$_POST['tel']</code> to the <code>$message</code> variable so in the body of the email I can get the message plus the telephone that people type into the form. In the first part of the code I think I made the telephone input obligatory.</p>
  
  <p>I tried doing <code>$message = $_POST['comment'] &amp;&amp; $_POST['tel'];</code> but the only thing I recieve is a <code>1</code> in the body of the mail that is the first number of the telephone entered.</p>