submit a form in a new tab

To open a form submission in a new tab, you can use the target attribute of the form element and set it to _blank. Here is an example:

<form action="/submit-form.php" method="post" target="_blank">
  <!-- form elements go here -->
  <button type="submit">Submit</button>
</form>

This will open the form submission in a new tab. The action attribute specifies the URL of the page that will handle the form submission, and the method attribute specifies the HTTP method that will be used to submit the form (either "get" or "post").

Watch a course Learn object oriented PHP

You can also use JavaScript to open the form submission in a new tab. To do this, you can add an event listener to the form's submit event, and call the window.open() function with the URL of the form submission as the argument. Here is an example:

<form id="my-form" action="/submit-form.php" method="post">
  <!-- form elements go here -->
  <button type="submit">Submit</button>
</form>

<script>
  var form = document.getElementById('my-form');
  form.addEventListener('submit', function(event) {
    event.preventDefault();
    window.open(form.action, '_blank');
  });
</script>

This will open the form submission in a new tab when the form is submitted.