Php 如何使用save asking生成pdf并重定向到其他页面?

Php 如何使用save asking生成pdf并重定向到其他页面?,php,pdf,header,mpdf,Php,Pdf,Header,Mpdf,我不知道如何直接解释我的问题。我有一个表单,通过点击提交按钮发送到数据库。我想要的是在点击提交按钮后从我的表单生成pdf。它应该确认是否保存此pdf,并在单击“保存”或“取消”后重定向到另一页。我尝试了此代码,但它不能满足我的要求: $mytext='text from textarea'; include('css/pdf/MPDF57/mpdf.php'); $mpdf=new mPDF(); $htmlbuffer = $mytext; $mpdf->WriteHTML($htmlb

我不知道如何直接解释我的问题。我有一个表单,通过点击提交按钮发送到数据库。我想要的是在点击提交按钮后从我的表单生成pdf。它应该确认是否保存此pdf,并在单击“保存”或“取消”后重定向到另一页。我尝试了此代码,但它不能满足我的要求:

$mytext='text from textarea';
include('css/pdf/MPDF57/mpdf.php');
$mpdf=new mPDF();
$htmlbuffer = $mytext;
$mpdf->WriteHTML($htmlbuffer);
$mpdf->SetTitle('Uwagi do planu');
$mpdf->SetAuthor('Name Surname');
$mpdf->Output("test.pdf");
header("Pragma: public");

header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-type: application/pdf");
header("Content-Disposition: attachment; filename=test.pdf");
header("Content-Transfer-Encoding: binary");
readFile("test.pdf");
header("Location: index.php?p=info");