title: How to pass form values to another file using javascript?
body: <p>so we had a hands-on exam yesterday wherein we have to enter name, prelim, midterm and final grade. After sending it to another file, the input values will automatically appear on another textbox to be finalized, wherein the average of prelim, midterm and final will be calculated. Then finally, if I l click the finalize button, the value will be outputted. Out teacher told us to use php and javascript but I went to use just php instead, because it was alot easier.
  Then after the hands-on, our teacher told us that there will be another one, but now, we have to use javascript since most of us used php. I tried the same thing using javascript but I don't know how to get form values from another file to be outputted using javascript just like php's post method. I don't plan to remake all of it using javascript, I just want to change the send.php codes. Here is the php code from our hands-on exam:</p>
  
  <p>/////////////////////////////////////////gradebook.php//////////////////////////////////////////////</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  
  &lt;html&gt;
  
  &lt;head&gt;
  
  
  
  &lt;title&gt;Gradebook&lt;/title&gt;
  
  &lt;/head&gt;
  
  
  &lt;body&gt;
  
  
  
  
  
  &lt;form action="verify.php" method="POST"&gt;
  &lt;h1&gt;Grade Book&lt;/h1&gt;
  &lt;table&gt; 
      &lt;tr&gt;
          &lt;td&gt;Name:&lt;/td&gt;
          &lt;td&gt;&lt;input type="text" name="name" size="25"&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Prelim:&lt;/td&gt;
          &lt;td&gt;&lt;input type="text" name="prelim" size="25"&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Midterm:&lt;/td&gt;
          &lt;td&gt;&lt;input type="text" name="midterm" size="25"&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Finals:&lt;/td&gt;
          &lt;td&gt;&lt;input type="text" name="final" size="25"&gt;&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/table&gt;
      &lt;input type="submit" name="submit" value="Submit"&gt;
  &lt;/form&gt;
  
  
  &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>
  
  <p>/////////////////////////////////////////verify.php//////////////////////////////////////////////</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  
  &lt;title&gt;Verify&lt;/title&gt;
  
  &lt;/head&gt;
  </code></pre>
  
  <p></p>
  
  <pre><code>&lt;?php 
      $name = $_POST['name'];
      $_POST['prelim'];
      $_POST['midterm'];
      $_POST['final'];
  
      $total = 0.3 * $_POST['prelim'] + 0.3 * $_POST['midterm'] + 0.4 * $_POST['final'];
  ?&gt;
  
  &lt;form action="newsend.html" method="POST"&gt;
  &lt;table&gt;
      &lt;tr&gt;
     &lt;td&gt;Name:&lt;input type="text "name="vname" size="25" id="vername" value="&lt;?php echo     
     $name;?&gt;"&gt;&lt;/td&gt;
      &lt;/tr&gt;
  
      &lt;tr&gt;
      &lt;td&gt;Grade:&lt;input type="text"name="vgrade" size="25" id="vergrade"  value="&lt;?php     
   echo $total;?&gt;"&gt;&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/table&gt;
          &lt;input type="submit" name="vsubmit" value="Finalize"&gt;
  &lt;/form&gt;
  
  &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>
  
  <p>/////////////////////////////////////////send.php//////////////////////////////////////////////</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  
  &lt;title&gt;Send&lt;/title&gt;
  
  &lt;/head&gt;
  
  
  &lt;body&gt;
  
  &lt;?php 
  
      $vname = $_POST['vname'];
  
      $vgrade = $_POST['vgrade'];
  
      echo 'Name: '.$vname.'&lt;br/&gt;';
      echo 'Grade: '.$vgrade;
  
  
  ?&gt;
  
  &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>