title: Form is submitting but not sending data via POST
body: <p>It may seem to duplicate as <a href="https://stackoverflow.com/questions/19887112/simple-form-not-sending-data-via-post">this</a> but it is not. And <a href="https://stackoverflow.com/questions/21778790/form-is-submit-but-values-are-not-passing">this</a> is also not my case for the same reason.</p>
  
  <hr>
  
  <p>Here is my <code>form</code> code.</p>
  
  <pre><code>   &lt;form id="form-box" name="formName" action="notes-uploading.php" onSubmit="return validateForm()" method="POST" enctype="multipart/form-data"&gt;
              &lt;div class="sub-box" align="left"&gt;
                  &lt;div class="sub-box-name"&gt;
                      &lt;div class="box-num" align="center"&gt;1&lt;/div&gt;
                      &lt;div class="box-name"&gt;Notes Info&lt;/div&gt;
                  &lt;/div&gt;
  
                  &lt;!-- Text [Name] --&gt;
                  &lt;input type="text" name="naam" class="sub-box-ip-txt" placeholder="Notes/Assignment Name*" required&gt;
  
  
                  &lt;!-- Select [Stream] --&gt;
                  &lt;select id="select-input" name="stream" required&gt;
                      &lt;option value="Wrong"&gt;Choose a stream&lt;/option&gt;
                      &lt;option value="Science &amp; Engineering"&gt;Science &amp; Engineering&lt;/option&gt;
                      &lt;option value="Business &amp; Management"&gt;Business &amp; Management&lt;/option&gt;
                      &lt;option value="Arts &amp; Humanity"&gt;Arts &amp; Humanity&lt;/option&gt;
                      &lt;option value="Architecture"&gt;Architecture&lt;/option&gt;
                      &lt;option value="Medical"&gt;Medical&lt;/option&gt;
                      &lt;option value="Law"&gt;Law&lt;/option&gt;
                      &lt;option value="Competition"&gt;Competition&lt;/option&gt;
                      &lt;option value="Others"&gt;Others&lt;/option&gt;
                  &lt;/select&gt;
  
                  &lt;div class="error" id="slctErr"&gt;&lt;/div&gt;
  
                  &lt;!-- Text [Subject] --&gt;
                  &lt;input type="text" name="subject" class="sub-box-ip-txt" placeholder="Subject Name*" required&gt;
  
                  &lt;!-- Text [Topic Name] --&gt;
                  &lt;input type="text" name="topic" class="sub-box-ip-txt" placeholder="Topic Name*" &gt;
  
                  &lt;!-- Text [Course] --&gt;
                  &lt;input type="text" name="course" class="sub-box-ip-txt" placeholder="Course*" &gt;
  
                  &lt;!-- Text [Branch] --&gt;
                  &lt;input type="text" name="branch" class="sub-box-ip-txt" placeholder="Branch*" &gt;
  
                  &lt;span class="field-name"&gt;Upload Docs:&lt;/span&gt;
  
                  &lt;label id="upload-btn"&gt;
                      &lt;input type="file" name="files[]" accept=".jpg, .png, .jpeg, .pdf, .ppt, .docx, .xlsx" id="img-upload" multiple&gt;
                     &lt;span class="upload-button"&gt;&lt;i class="fa fa-upload"&gt;&lt;/i&gt;Select Docs*&lt;/span&gt;
                  &lt;/label&gt;
  
                  &lt;div class="error" id="uploadErr"&gt;&lt;/div&gt;
  
  
                  &lt;textarea form="form-box" name="description" class="text-area-input" placeholder="Description"&gt;&lt;/textarea&gt;
  
  
                  &lt;input type="submit" name="submit" class="submit"&gt;
  
  
              &lt;/div&gt;
          &lt;/form&gt;
  </code></pre>
  
  <hr>
  
  <p>And below is the validateForm() method, as it may be the reason of the problem.</p>
  
  <pre><code>&lt;script&gt;
          function validateForm(){
  
              var checkForm;
  
  
              /*Validating Select*/
              var stream = document.forms["formName"]["select-input"];
              var slctErr = document.getElementById("slctErr");
              if(stream.value == "Wrong"){
                  slctErr.innerHTML = "Please select a stream";
                  checkForm = false;  
              }
              else{
                  slctErr.innerHTML = "";
                  checkForm = true;   
              }
  
              /*----Validating Image Upload----*/
              var files = document.getElementById("img-upload").files;
              var uploadErr = document.getElementById("uploadErr");
              if(files.length &gt; 20){
                  uploadErr.innerHTML = "Max 20 photos are allowed.";
                  checkForm = false;
              }
              else if(files.length == 0){
                  uploadErr.innerHTML = "Upload 1 or more photos.";   
                  checkForm = false;
              }
              else{
                  uploadErr.innerHTML = "";
                  checkForm = checkForm &amp;&amp; true;  
              }
              return checkForm;
          }
      &lt;/script&gt;
  </code></pre>
  
  <hr>
  
  <p>I have <code>name</code> attribute in all the <code>input</code> fields of the <code>form</code>. </p>
  
  <p>Below is my <code>notes-uploading.php</code> page code snippet.</p>
  
  <pre><code>/*if someone tries to Direct access of this page*/
   if($_SERVER["REQUEST_METHOD"] != "POST"){
      die('Invalid Access: Page: notes-uploading.php; Line: 9'); 
   }
  </code></pre>
  
  <p>Browser prints this. I removed this line, so it shows that <code>index</code> not defined, that is the data is not received.</p>
  
  <p><strong>Where is the problem? Why the form is submitting but not sending data via POST.</strong></p>