I really need help.

Have a four page form that posts to makepdf.php .. a littel down the code you will see where I marked "HERE!!!!!" . This is where I inserted a variable from the form $fname. The pdf is generated and emailed....but the variables will not show...anyone have any ideas??? If i put echo "$fname" at the top of the file it outputs the data just before it spawns the pdf....but not within.


I am losing my mind.

PHP Code:
<?php
function CleanFiles($dir)
{
    
//Delete temporary files
    
$t=time();
    
$h=opendir($dir);
    while(
$file=readdir($h))
    {
        if(
substr($file,0,3)=='tmp' and substr($file,-4)=='.pdf')
        {
            
$path=$dir.'/'.$file;
            if(
$t-filemtime($path)>3600)
                @
unlink($path);
        }
    }
    
closedir($h);


define('FPDF_FONTPATH','./font/');
require(
'fpdf.php');
class 
PDF extends FPDF
{

    function 
Header()
    {
        global 
$title;

        
//$this->Image('inc/img/logo.PNG',10,8,33);

        //Arial bold 15
        
$this->SetFont('Arial','',15);

        
//Calculate width of title and position
        
$w=$this->GetStringWidth($title)+6;
        
$this->SetX((210-$w)/2);

        
//Colors of frame, background and text
        //$this->SetDrawColor(0,80,180);
        
$this->SetFillColor(255,255,255);
        
$this->SetTextColor(0,0,0);

        
//Thickness of frame (1 mm)
        //$this->SetLineWidth(1);

        //Title
        
$this->Cell($w,9,$title,1,1,'C',1);

        
//Line break
        
$this->Ln(10);
    }

    function 
Footer()
    {
        
//Position at 1.5 cm from bottom
        
$this->SetY(-15);
        
//Arial italic 8
        
$this->SetFont('Arial','I',8);
        
//Text color in gray
        
$this->SetTextColor(128);
        
//Page number
        
$this->Cell(0,10,'Page '.$this->PageNo(),0,0,'C');
    }
    function 
FormTitle($label)
    {
        
//Arial 12
        
$this->SetFont('Arial','',12);

        
//Background color
        
$this->SetFillColor(0,0,0);
        
$this->SetTextColor(255);

        
//Title
        
$this->Cell(0,6,"$label",0,1,'L',1);

        
$this->SetTextColor(0);

        
//Line break
        
$this->Ln(4);
    }

    function 
ChapterBody($file)
    {
        
//Read text file
        
$f=fopen($file,'r');
        
$txt=fread($f,filesize($file));
        
fclose($f);

        
//Times 12
        
$this->SetFont('Times','',12);

        
//Output justified text
        
$this->MultiCell(0,5,$txt);

        
//Line break
        
$this->Ln();

        
//Mention in italics
        //$this->SetFont('','I');
        //$this->Cell(0,5,'(end of excerpt)');
    
}

    
// PAGE ONE
    
function PrintPage1($title,$file1)
    {
        
$this->AddPage();
        
$this->FormTitle($title);
        
//
        
$this->ChapterBody($file1);
    }

    
// PAGE TWO
    
function PrintPage2()
    {
        
$this->AddPage();

        
// **** SECTION ONE

        //Arial 12
        
$this->SetFont('Arial','',12);

        
//Background color
        
$this->SetFillColor(0,0,0);
        
$this->SetTextColor(255);

        
//Title
        
$this->Cell(0,6,'PERSONAL DATA',0,1,'L',1);
        
$this->SetTextColor(0);

        
//Read text file
        
$f=fopen('personal.txt','r');
        
$txt=fread($f,filesize('personal.txt'));
        
fclose($f);

        
//Times 12
        
$this->SetFont('Times','',12);

        
//Output justified text
        
$this->MultiCell(0,5,$txt);
        
$this->Cell(0,5,$fname);

        
//Line break
        
$this->Ln(4);

        
// **** SECTION TWO

        //Arial 12
        
$this->SetFont('Arial','',12);

        
//Background color
        
$this->SetFillColor(0,0,0);
        
$this->SetTextColor(255);

        
//Title
        
$this->Cell(0,6,'EMPLOYMENT INFORMATION',0,1,'L',1);
        
$this->SetTextColor(0);

        
$this->SetFont('Arial','',10);

        
// **** ONE
        //Centered text in a framed 130*10 mm cell and line break
        
$this->Cell(120,5,'Position(s) applied for:');
        
$this->Cell(70,5,'Hourly wage or salary? o Hourly o Salary','LR');
        
$this->Ln();
        
$this->Cell(120,5,'');
        
$this->Cell(70,5,'$','LR');
        
$this->Ln();
        
$this->Cell(120,5,'');
        
$this->Cell(70,5,'Days of the week available:','LRT');
        
$this->Ln();
        
$this->Cell(120,5,'','B');
        
$this->Cell(70,5,'o M o T o W o Th o F o Sat o Sun','LRB');
        
$this->Ln();

        
// **** TWO
        //Centered text in a framed 130*10 mm cell and line break
        
$this->Cell(120,5,'Location(s) I am willing to work at:');
        
$this->Cell(70,5,'What date are you available to start work?','LR');
        
$this->Ln();
// HERE !!!!
        
$this->Cell(70,5,$fname,'LR');
        
$this->Ln();
        
$this->Cell(70,5,'','LR');
        
$this->Ln();
        
$this->Cell(70,5,'Days of the week available:','LRT');
        
$this->Ln();
        
$this->Cell(70,5,'o M o T o W o Th o F o Sat o Sun','LRB');

        
$this->Ln();
        
$this->Ln();
        
$this->Cell(0,10,'If so, please specify location(s) and date(s):','B');

        
$this->Ln();
        
$this->Ln();
        
$this->Ln();

        
//Line break
        
$this->Ln(4);

        
// **** SECTION THREE

        //Arial 12
        
$this->SetFont('Arial','',12);

        
//Background color
        
$this->SetFillColor(0,0,0);
        
$this->SetTextColor(255);

        
//Title
        
$this->Cell(0,6,'EDUCATION AND TRAINING',0,1,'L',1);
        
$this->SetTextColor(0);

        
// HEADER COLUMNS
        
$this->SetFont('Arial','',8);
        
$this->Cell(38,8,'Type of School','LR');
        
$this->Cell(45,8,'Name and Address of School','LR');
        
$this->Cell(22,8,'Dates Attended','LR');
        
$this->Cell(22,8,'Graduated','LR');
        
$this->Cell(35,8,'Type of Degree','LR');
        
$this->Cell(28,8,'Major / Minor','LR');
        
$this->Ln();
        
$this->Cell(38,8,'','LR');
        
$this->Cell(45,8,'','LR');
        
$this->Cell(11,8,'From','LR');
        
$this->Cell(11,8,'To','LR');
        
$this->Cell(11,8,'Yes','LR');
        
$this->Cell(11,8,'No','LR');
        
$this->Cell(35,8,'Diploma or Certificate','LR');
        
$this->Cell(28,8,'Filed of Study','LR');
        
$this->Ln();
        
$this->Cell(38,8,'High School',1);
        
$this->Cell(45,8,'',1);
        
$this->Cell(11,8,'',1);
        
$this->Cell(11,8,'',1);
        
$this->Cell(11,8,'',1);
        
$this->Cell(11,8,'',1);
        
$this->Cell(35,8,'',1);
        
$this->Cell(28,8,'',1);
        
$this->Ln();
        
$this->Cell(38,8,'College or University',1);
        
$this->Cell(45,8,'',1);
        
$this->Cell(11,8,'',1);
        
$this->Cell(11,8,'',1);
        
$this->Cell(11,8,'',1);
        
$this->Cell(11,8,'',1);
        
$this->Cell(35,8,'',1);
        
$this->Cell(28,8,'',1);
        
$this->Ln();
        
$this->Cell(38,8,'Other Education / Training',1);
        
$this->Cell(45,8,'',1);
        
$this->Cell(11,8,'',1);
        
$this->Cell(11,8,'',1);
        
$this->Cell(11,8,'',1);
        
$this->Cell(11,8,'',1);
        
$this->Cell(35,8,'',1);
        
$this->Cell(28,8,'',1);
        
$this->Ln();
        
$this->Cell(0,12,'Summarize any special skills, licenses and/or certificates that may assist you in performing the positions for which you are applying:',0);
        
$this->Ln();

        
//Line break
        
$this->Ln(4);

        
// **** SECTION FOUR

        //Arial 12
        
$this->SetFont('Arial','',12);

        
//Background color
        
$this->SetFillColor(0,0,0);
        
$this->SetTextColor(255);

        
//Title
        
$this->Cell(0,6,'BUSINESS OR PROFESSIONAL REFERENCES',0,1,'L',1);
        
$this->SetTextColor(0);

        
// SET UP THE TABLE
        
$header=array('NAME''YEARS KNOWN''RELATIONSHIP''STREET ADDRESS''CITY''STATE''TELEPHONE');

        
$this->SetFont('Arial','',8);
        foreach(
$header as $col)
        {
            
$this->Cell(27,8,$col,1);
        }

        
$this->Ln();
        foreach(
$header as $col)
        {
            
$this->Cell(27,8,'',1);
        }

        
$this->Ln();
        foreach(
$header as $col)
        {
            
$this->Cell(27,8,'',1);
        }

        
$this->Ln();
        foreach(
$header as $col)
        {
            
$this->Cell(27,8,'',1);
        }
        
$this->Ln();


        
$this->SetFont('Arial','',12);
        
//Line break
        
$this->Ln(4);

    }

}

$pdffile=basename(tempnam(getcwd(),'tmp'));

$pdf=new PDF();

$pdf->Open();
$pdf->SetTitle($title);
$pdf->SetAuthor('Lobster');


$pdf->PrintPage1('EMPLOYMENT APPLICATION FORM','release.txt');
$pdf->PrintPage2();
$pdf->PrintPage3();
$pdf->PrintPage4('APPLICANT STATEMENT','terms.txt');

rename($pdffile,$pdffile.'.pdf');
$pdffile.='.pdf';
$pdf->Output($pdffile);
echo 
"<HTML><SCRIPT>document.location='$pdffile';</SCRIPT></HTML>"

//mailer class 
require('phpmailer/class.phpmailer.php'); 

//instantiate 
$mail = new PHPMailer(); 

$mail->From "Me"
$mail->Subject "Generated PDF File"

$mail->AddAddress($email); 

// this will attach the generated PDF 
$mail->AddAttachment($pdffile,"application.pdf"); 

if(!
$mail->Send()){ 
echo 
"There has been a mail error sending to " $email "<br>"
}else{ 
echo 
"The PDF file(s) have been sent to " $email "<br>"

exit;
?>


Thanks

L