Problem in fetching value from an input field and output it on screen

The problem here is I cant fetch the values from an input field and do the conditions in js
and then output it on screen

You’ll have to add a submit event handler to the <form> element. In the event handler, you’ll then get the values from the textboxes, then do whatever computation you want.

This form also doesn’t need the action and the method attributes, since you’re not actually submitting data to some backend system.

document.getElementById('form').addEventListener('submit', function(e) {
  e.preventDefault(); // This prevents the form from submitting data

  const p1Age = document.getElementById('p1age').value;
  const p1Height = document.getElementById('p1height').value;

  // Do the same for the other ages and heights
  // Then do computation on the numbers, then output