$flier->submit ($selectcat, $myName, $lastName, $dob, $DLnumber, $race, $sex, $height, $weight, $haircolor, $address, $tattoos,$summary, $adtnlinfo, $newfilename, $author, $agency, $link);
	$data = $flier->getlast();

	$result = $data->fetch_assoc(); 
	$id = $result['bolo_id']; 
	$url = "/bolofliercreator/wp-content/themes/inkness/BoloSelected.php?idBolo=" . $id;
	echo "<script>window.location = '$url'      </script>";
    
   if (realpath('uploads/preview' . $author . '.pdf'))
   {
       //delete the preview file
       unlink('uploads/preview' . $author. '.pdf');
   } 

    //submit information for pdf creation
    $flier = new FlierModel();
    $flier->submit_pdf($selectcat, $myName, $lastName, $dob, $DLnumber, $race, $sex, $height, $weight, $haircolor, $address, $tattoos,$summary, $adtnlinfo,$newfilename,$author,$agency,$link, TRUE);    
    
    $result = $flier->get_bolo();
    include"BoloPDF/bolo_pdf.php";
    $doc = new bolo_pdf();
    //created pdf using submitted information
    $doc->save_pdf($result, TRUE, $author);
   
   //send email with PDF file
    include_once'emailController.php';
	
	
    //delete the generated pdf
    //$flier->remove_pdf($selectcat, $myName, $lastName, $dob, $DLnumber, $race, $sex, $height, $weight, $haircolor, $address, $tattoos,$summary, $rcheckboxes,$vcheckboxes,$clacheckboxes,$adtnlinfo,$newfilename,$author,$agency,$link);
   	//die();
 $sex=$_POST ['sex'];
 $height=$_POST ['height'];
 $weight=$_POST ['weight'];
 $haircolor=$_POST ['haircolor'];
 $address=$_POST ['address'];
 $tattoos=$_POST ['tattoos'];
 $adtnlinfo=$_POST ['adtnlinfo'];
 $summary=$_POST ['summary'];
 $author = $_POST['author'];
 $agency = $_POST['agency'];
 $link = $_POST['link'];
 $previousID = $_POST ['previewBOLOid'];
 
 
 //submit data and save it
 $flier = new FlierModel();
 if (isset($previousID))
 {
     $flier->remove($previousID);
 }
 $flier->submitPreview($selectcat, $myName, $lastName, $dob, $DLnumber, $race, $sex, $height, $weight, $haircolor, $address, $tattoos,$summary,$adtnlinfo,$newfilename,$author,$agency,$link);
 //$data = $flier->getPreview($selectcat, $myName, $lastName, $dob, $DLnumber, $race, $sex, $height, $weight, $haircolor, $address, $tattoos,$summary, $rcheckboxes,$vcheckboxes,$clacheckboxes,$adtnlinfo,$newfilename,$author,$agency,$link);
 $data = $flier->getlast();
 $ua = strtolower($_SERVER['HTTP_USER_AGENT']);
 if (stripos($ua, 'android') !== false || stripos($ua, 'iphone') !== false || stripos($ua, 'ipad') !== false) {
     $mobile = TRUE;
 } else {
     $mobile = FALSE;
 }
 $result = $data->fetch_assoc(); 
 $boloID = $result['bolo_id'];
<?php
	include "flier_model.php";
    $boloID = $_GET[boloID];
	
	$flier = new FlierModel;
    $flier->remove($boloID);

?>