title: React form doesn't send data to php file
body: <p>Last weeks I work on a React site. And everything went okay, but I would like to make a contact page with a form. In HTML/PHP you just use action="", but I tried that, but it is not working.</p>
  
  <p>Can someone help me out?</p>
  
  <p><strong>form-contact.js:</strong></p>
  
  <pre><code>    import React from 'react';
  
      const ContactForm = (props) =&gt; {
  
      return (
          &lt;div className={'inputs'} style={{
              position: "absolute",
              top: 0,
              width: 46 + '%'
          }}&gt;
              &lt;form action={'../mail_functions/mailto.php'} method={'POST'} encType={'multipart/form-data'}&gt;
                  &lt;div&gt;
                      &lt;span&gt;Uw naam&lt;/span&gt;
                  &lt;/div&gt;
                  &lt;input name={'username'} type={'text'} id={'name'} required/&gt;
  
                  &lt;div&gt;
                      &lt;span&gt;Uw emailadres&lt;/span&gt;
                  &lt;/div&gt;
                  &lt;input name={'email-address'} type={'email'} id={'emailaddress'} required/&gt;
  
                  &lt;div&gt;
                      &lt;span&gt;Onderwerp&lt;/span&gt;
                  &lt;/div&gt;
                  &lt;input name={'subject-mail'} type={'text'} id={"subject"} required/&gt;
  
                  &lt;div&gt;
                      &lt;span&gt;Uw bericht&lt;/span&gt;
                  &lt;/div&gt;
                  &lt;textarea name={'contentmail'} id={'message'} style={{
                      maxWidth: 100 + '%',
                      minWidth: 100 + '%',
                      maxHeight: 200 + 'px',
                      minHeight: 40 + 'px'
                  }} required/&gt;
  
                  &lt;input type={"submit"} name={'submit'} value={'Verstuur'}/&gt;
              &lt;/form&gt;
          &lt;/div&gt;
      )
      }
  
      export default ContactForm;
  </code></pre>
  
  <p><strong>mailto.php:</strong></p>
  
  <pre><code>    &lt;?php
  
      $username = $_POST['username'];
      $emailAddress = $_POST['email-address'];
      $subjectMail = $_POST['subject-mail'];
      $contentMail = $_POST['contentmail'];
      $submit = $_POST['submit'];
  
      $msg = 'testmail succesvol ontvangen!';
      $mailTo = 'info@lala.com';
  
  
      if(isset($submit) &amp;&amp; $_SERVER['REQUEST_METHOD'] == 'POST') {
  
          mail($mailTo, "testmail", $msg);
  
      }
  
      header('Location: ../pages/contact.js');
      die();
  </code></pre>
  
  <p>Hopefully someone could help me out. I am struggling with this for multiple days. </p>