I want to create a PDF from a form, but im stuck. It says "Some data has already been output" and I know it's the $name. But any idea how I can solve this problem?
<?php
ob_end_clean();
if(!empty($_POST['submit']))
{
$name= $_POST['name'];
$date = $_POST['date'];
$movie = $_POST['movie'];
}
require_once ('fpdf/fpdf.php');
$pdf = new FPDF();
$pdf->AddPage();
$pdf->SetFont('Arial','B',16);
$pdf->Cell(40,10,$name);
$pdf->Output();
ob_end_flush();
?>