I currently have a button (print) that performs a submit on the form (since I need some fields that are in that form). This in turn executes the code that is in the action, where I have the following code:
echo "<script>window.open('".$url."', '_blank');</script>";
Well, if you run the script in this way, a new tab is opened in the browser, but the original page will fail (indexed variable that does not receive value). To get around this error, I thought about executing a header.
Looking like this:
header('location:../paginaOriginal.php');
echo "<script>window.open('".$url."', '_blank');</script>";
exit;
But when I put the header, it does not open the new tab, simply reload the page.
Button script:
$("#botao1").click(function(){
$("#form").submit();
});
Ideally the original page should remain static because it is a print button. But I need some fields that are in the form of that page and put that data in a layout already ready.