I want to first detect whether at least three out of ten textboxes are filled, and then pass the response data to the next URL.
I achieved the first step by using <input type="button" value="CONTINUE" onclick='myfunction();'> where myfunction specifies that
function myfunction() {
  if (response<3) {
    location.href = "URL";
  }
  else {
    alert("Please give at least three responses.");
  }
}
However, I don't know how to do the second step.
I used to use <form method="POST" action="URL">when the input type was "submit". But since now I am using "button" in order to have the onclick where I can incorporate the alert, what I can do to pass the data to another URL?
Below are all the code I have:
<html>
<body>      
<div align="center">
  <table border="0" cellpadding="3" cellspacing="0">
     <tr height=40>
     <td>Thought 1: </td>
       <td><textarea rows="3" name="th_1" cols="60" id="th_1"></textarea></td>
       </tr>
    </table>
  <table border="0" cellpadding="3" cellspacing="0">
     <tr height=40>
     <td>Thought 2: </td>
      <td><textarea rows="3" name="th_2" cols="60"id="th_2"></textarea></td>
       </tr>
      </table>
  <table border="0" cellpadding="3" cellspacing="0">
     <tr height=40>
     <td>Thought 3: </td>
     <td><textarea rows="3" name="th_3" cols="60"id="th_3"></textarea></td>
     </tr>
   </table>
  <table border="0" cellpadding="3" cellspacing="0">
     <tr height=40>
     <td>Thought 4: </td>
     <td><textarea rows="3" name="th_4" cols="60"id="th_4"></textarea></td>
     </tr>
   </table>
  <table border="0" cellpadding="3" cellspacing="0">
     <tr height=40>
     <td>Thought 5: </td>
      <td><textarea rows="3" name="th_5" cols="60"id="th_5"></textarea></td>
      </tr>
   </table>
  <table border="0" cellpadding="3" cellspacing="0">
     <tr height=40>
     <td>Thought 6: </td>
       <td><textarea rows="3" name="th_6" cols="60" id="th_6"></textarea></td>
       </tr>
    </table>
  <table border="0" cellpadding="3" cellspacing="0">
     <tr height=40>
     <td>Thought 7: </td>
       <td><textarea rows="3" name="th_7" cols="60"id="th_7"></textarea></td>
       </tr>
    </table>
  <table border="0" cellpadding="3" cellspacing="0">
     <tr height=40>
     <td>Thought 8: </td>
       <td><textarea rows="3" name="th_8" cols="60"id="th_8"></textarea></td>
       </tr>
   </table>
  <table border="0" cellpadding="3" cellspacing="0">
     <tr height=40>
     <td>Thought 9: </td>
     <td><textarea rows="3" name="th_9" cols="60"id="th_9"></textarea></td>
     </tr>
   </table>
  <table border="0" cellpadding="3" cellspacing="0">
     <tr height=40>
     <td>Thought 10: </td>
     <td><textarea rows="3" name="th_10" cols="60"id="th_10"></textarea></td>
     </tr>
   </table>
</div>
<p align="center"><input type="button" value="CONTINUE" onclick='checknumber();'></p>
<script>
function formHasAtLeast(answersCount) {
  let count = 0;
  for (let i = 1; i <= 10; i++) {
    const textBoxValue = document.getElementById('th_' + i).value;
    if (textBoxValue.trim() !== '') count++;
    if (count === answersCount) return true; 
  }
  return false;
}
function checknumber() {
  const minAnswers = 3;
  if (formHasAtLeast(minAnswers)) {
    location.href='URL';
  }
  else {
    alert("Please enter at least 3 thoughts before you can continue.");
  }
}
</script>
</body>
</html>
 
     
     
    