title: How do you print user input in html using javascript?
body: <p>How to print the user input? Everytime I click on the submit button, it just redirects me to a blank page. Here's the code:</p>
  
  <pre><code>    &lt;html&gt;
  &lt;head&gt;
      &lt;title&gt;NameTest&lt;/title&gt;
      &lt;meta charset="UTF-8"&gt;
      &lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;form action="PayslipServlet" method="get"&gt;
  
          Last name:    &lt;input type="text" name="lname" id="lname"&gt;&lt;br/&gt;
          First name:   &lt;input type="text" name="fname" id="fname"&gt;&lt;br/&gt;
          Middle name:  &lt;input type="text" name="mname" id ="mname"&gt;&lt;br/&gt;
          Name:&lt;script&gt;document.write(document.getElementById('fname').value+" "+document.getElementById('mname').value+""+document.getElementById('lname').value);&lt;/script&gt;
          &lt;input type="submit" value="Submit"&gt;
      &lt;/form&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p></p>