I want to open my next file in a new window.
my code is
print("<form name='ReportsForm'action='window.open(HA_RptAcctStmt.php)' method='POST' onsubmit='return formcheck(ReportsForm)'>");}
It doesn't work but it seems to me it worked in the past.
Is there something wrong with action='window.open(HA_RptAcctStmt.php)'
The action attribute in the <form> tag is meant to specify where the form data should be sent after submission. It's not meant for JavaScript. What you're trying to do with the window.open() method should be in a JavaScript function, not inside the action attribute.
Here's a quick fix for ya:
Remove the window.open from the action attribute.
Add an event listener in your JavaScript to handle the form submission, and there you can pop the new window.
Here's how you can modify your code:
<script>
function openNewWindowAndSubmitForm() {
window.open('HA_RptAcctStmt.php', '_blank');
document.ReportsForm.submit();
return false; // prevent the default form submission
}
</script>