How can I pass Variables from a form submit into FPDF.
I have Something like this
<form method="post" action="pdf_page.php">
<input id="name" type="text" size="20" />
<button type="submit" class="btn btn-primary" id="btn_next">Submit</button>
</form>
and this is my pdf_page.php
<?php
$name=$_POST['name'];
require('fpdf/fpdf.php');
$pdf= new FPDF('P','mm','A4');
$pdf->AddPage();
$pdf->SetFont('Arial','','9');
$pdf->Cell('80','4',$name,'0','1',''); ////i want to show the variable here
$pdf->Output();
?>
when I hit the Submit button, I get these errors
Undefined index: name in C:........
Fatal error: Uncaught exception 'Exception' with message 'FPDF error: Some data has already been output, can't send PDF file' in C:\wamp64\www\Form\fpdf\fpdf.php on line 271
Exception: FPDF error: Some data has already been output, can't send PDF file in C:\wamp64\www\Form\fpdf\fpdf.php on line 271
What am I doing Wrong?? I don't need to store the variables in Mysql I just want to pass them into the pdf file..... Can anybody Help me ?