i am create a website in which I can download the user information in pdf but the file name I want to give like filename=username ok the file that is download is detail.pdf but i want it like username.pdf
here is the code
if (isset($_POST['pdf'])) {
$mpdf = new \Mpdf\Mpdf();
$body = "<h1>your details</h1>
<strong>first name:</strong>$fname <br>
<strong>last name:</strong>$lname <br>
<strong>username:</strong>$username <br>
<strong>email:</strong>$email <br>
<strong>contact-no:</strong>$contact <br>
<strong>date of birth:</strong>$dob <br>
<strong>course </strong>$course <br>
<h2>your subjects</h2> <br>
<strong>subject 1:</strong>$sub1 <br>
<strong>subject 2:</strong>$sub2 <br>
<strong>subject 3:</strong>$sub3 <br>
<strong>subject 4:</strong>$sub4 <br>
<strong>subject 5:</strong>$sub5 <br>
<strong>subject 6:</strong>$sub6 <br>
<strong>subject 7:</strong>$sub7 <br>
";
$filename = md5($fname);
$mpdf->WriteHTML($body);
$mpdf->Output(`$filename.pdf`, 'D');
}
}
} else {
header('location:logout.php');
}
Aucun commentaire:
Enregistrer un commentaire