title: how to send form element values directly to php page using javascript
body: <p>What I am trying here is when you click on submit button I am calling one javascript function which takes all the form element values and passes it to the php page without storing them inside the variable and then send those variables.</p>
  
  <p>Example of my form:</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;form enctype="multipart/form-data" method="post" name="fileinfo"&gt;
    &lt;label&gt;Your email address:&lt;/label&gt;
    &lt;input type="email" autocomplete="on" autofocus name="userid" placeholder="email" required size="32" maxlength="64" /&gt;
    &lt;br /&gt;
    &lt;label&gt;Custom file label:&lt;/label&gt;
    &lt;input type="text" name="filelabel" size="12" maxlength="32" /&gt;
    &lt;br /&gt;
    &lt;label&gt;File to stash:&lt;/label&gt;
    &lt;input type="text" name="email" required /&gt;
    &lt;input type="button" onsubmit="sendvalues()" value="Stash the file!" /&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Now on javascript, I want to send userid and email fields to directly go to php page without first retrieving them into a variable and then send that variable via ajax.</p>
  
  <pre class="lang-js prettyprint-override"><code>function sendValues() {
    var formElement = document.querySelector("form");
    console.log(formElement);
    var formData = new FormData(formElement);
    var request = new XMLHttpRequest();
    request.open("POST", "&lt;?php echo VIEW_HOST_PATH;?&gt;process_data.php");
    formData.append("process_type", 'process_data');
    request.send(formData); //want to send all form userid, email directly to php page
    request.onreadystatechange = (e) =&gt; {
      console.log(request.responseText)
    }
  }
  </code></pre>
  
  <p>Is this possible to send user_id and email values to php page directly? So, for example, form element which contains emailed and user info and any other forms element and they all send to php page via ajax but most important without storing this element values in javascript variables.
  thanks </p>