I'm using a website made only in PHP (no Framework). I 've created a button to allow user to download data in PDF. When he press button it will create a PDF and startinf downloading PDF.
<form action="" method="post">
<div class="input_field">
<input type="submit" value="Get Data" class="btn waves-effect waves-light myBlue" name="get_data">
</div>
</form>
the request is sent to a Controller :
<?php
$user = checkConnected($bdd)
checkAutorisation($user, true);
if (!isset($_POST['get_data'])) {
$pdf = new FPDF('P', 'mm', 'A4');
$pdf->SetFont('Arial', 'B', 16);
$pdf->Cell(40, 10, 'Hello World !', 1);
$pdf->Output();
}
require('views/Head.php');
require $_dir["front"] . "file.php";
But when I'm going to the page, I have an error 500 can't find FODF class. How can I fix it ? I've try of course with :
use Fpdf\Fpdf;
it changes nothing, any idea ?
Soluce found here, just have to say :
use \FPDF;