I have a form that when sent, executes an action that directs to another PHP page, where several scripts are executed and in the end a PDF file is generated for download.
All scripts and PDF generation are executed correctly, however, instead of directing to the page referenced in action, which in addition to executing the scripts, also has the function of displaying a success or error message, the system continues on the form screen, passing the impression to the user that the form was not sent, possibly leading to duplicate records.
Start and end of form:
<form id="form" method="post" action="function.php" enctype="multipart/form-data">
<input type="submit" name="submit" class="button" value="Enviar">
PHP code for PDF generation:
header('Pragma: no-cache');
ini_set('max_execution_time', 300);
$mpdf=new mPDF();
$mpdf->SetDisplayMode('fullpage');
$html = mb_convert_encoding($html, 'UTF-8', 'UTF-8');
$stylesheet = file_get_contents('_css/pdf_style.css');
$mpdf->WriteHTML($stylesheet,1);
$mpdf->WriteHTML($html,2);
$mpdf->Output('myPDF.pdf', 'D');
$mpdf->charset_in='windows-1252';
Demonstration of what happens after submission of the form:
I already checked the MPDF documentation but found no function to solve this problem. Is this a normal behavior of MPDF or is it missing any MPDF or PHP configuration?