title: Notice: Undefined index $_POST
body: <p>I am new to php and I made a contact form but i get a </p>
  
  <blockquote>
    <p>Notice: Undefined index: name in
    C:\xampp\htdocs\portfolio\portfolio\html\contact.php</p>
  </blockquote>
  
  <p>for the lines <code>$_POST</code> - Name, email, message  and human.</p>
  
  <p>How can I get take the error away??</p>
  
  <pre><code>                                    $name = $_POST['name'];
                                      $email = $_POST['email'];
                                      $message = $_POST['message'];
                                      $from = 'From:'; 
                                      $to = '86376@ict-idcollege.nl'; 
                                      $subject = 'Hello';
                                      $human = $_POST['human'];
  
                                      $body = "From: $name\n E-Mail: $email\n Message:\n $message";
                                          if (isset($_POST['submit'])) {
                                              if ($name != '' &amp;&amp; $email != '') {
                                                  if ($human == '4') {                 
                                                      if (mail ($to, $subject, $body, $from)) { 
                                                      echo '&lt;p&gt;Your message has been sent!&lt;/p&gt;';
                                                  } else { 
                                                      echo '&lt;p&gt;Something went wrong, go back and try again!&lt;/p&gt;'; 
                                                  } 
                                              } else if ($_POST['submit'] &amp;&amp; $human != '4') {
                                                  echo '&lt;p&gt;You answered the anti-spam question incorrectly!&lt;/p&gt;';
                                              }
                                              } else {
                                                  echo '&lt;p&gt;You need to fill in all required fields!!&lt;/p&gt;';
                                              }
                                          }
                                  ?&gt;
                                  &lt;form method="post" action="contact.php"&gt;
  
                                      &lt;label&gt;Name&lt;/label&gt;
                                      &lt;input name="name" placeholder="Type Here"&gt;
  
                                      &lt;label&gt;Email&lt;/label&gt;
                                      &lt;input name="email" type="email" placeholder="Type Here"&gt;
  
                                      &lt;label&gt;Message&lt;/label&gt;
                                      &lt;textarea name="message" placeholder="Type Here"&gt;&lt;/textarea&gt;
  
                                      &lt;label&gt;*Wat is 2+2? (Anti-spam)&lt;/label&gt;
                                      &lt;input name="human" placeholder="Type Here"&gt;
  
                                      &lt;input id="submit" name="submit" type="submit" value="Submit"&gt;
  
                                  &lt;/form&gt;
  </code></pre>