title: undefined index $_POST php contact form
body: <p>Can anyone help me, please. I have this code and I don't know why I've got these errors.</p>
  
  <pre><code>"Undefined index name, email and message"
  </code></pre>
  
  <p>I've tried to add an action in form :</p>
  
  <p><code>&lt;form action="?" method="post"&gt;</code> but doesn't work.</p>
  
  <pre class="lang-php prettyprint-override"><code>&lt;?php
  $to = 'myemail@something.else';
  $subject = 'From Site';
  
  $name = $_POST['name'];
  $email = $_POST['email'];
  $message = $_POST['message'];
  $header = '$email';
  
  if ($_POST) {
      mail($to, $subject, $message, $header);
  }
  ?&gt;
  
  &lt;html&gt;
      &lt;fieldset&gt;
          &lt;legend&gt;Contactat US&lt;/legend&gt;
          &lt;form method="post"&gt;
              &lt;label for="name"&gt;Name:&lt;/label&gt;&lt;br&gt;
              &lt;input type="text" name="name" id="name" /&gt;&lt;br&gt;
              &lt;label for="email"&gt;E-mail:&lt;/label&gt;&lt;br&gt;
              &lt;input type="text" name="email" id="email" /&gt;&lt;br&gt;               
              &lt;label for="message"&gt;Message:&lt;/label&gt;&lt;br&gt;
              &lt;textarea id="message" name="message" id="message" cols="42" rows="9"&gt;&lt;/textarea&gt;&lt;br&gt;&lt;br&gt;
              &lt;input type="submit" value="Send" /&gt;                
          &lt;/form&gt; 
      &lt;/fieldset&gt;
  &lt;/html&gt;
  </code></pre>