What is the recommended method to automatically submit a form with hidden variables in PHP?

When submitting a form with hidden variables in PHP, you can use JavaScript to automatically submit the form upon page load. This can be achieved by using the `submit()` method on the form element.

<form id="myForm" action="submit.php" method="post">
  <input type="hidden" name="hiddenVar1" value="value1">
  <input type="hidden" name="hiddenVar2" value="value2">
  <!-- other form fields -->
</form>

<script>
  document.getElementById("myForm").submit();
</script>