I have a form which a user fills out and submits. This will take the user to a review page where they can then either go back and make changes or submit their information. The user is then taken to a confirmation page.
I used FPDF to create the pdf. I need the information the user filled out to populate this PDF and then email an attachment of the file to their email and to an email with my company. I assume that creating an isset($_POST['Submit'] if statement on the review page and sending the email there would be my best course? I'm really not sure.
I'm new to PHP programming and still trying to learn but I am stuck. I just don't know how to do this. There is A LOT of code involved in this. I'll post the top portions of each page.
Review:
<?php
require_once('../../../../wp-load.php');
require_once('../includes/phpmailer/class.phpmailer.php');
require_once('../classes/504-send-request.php');
if(isset($_POST["Submit"])) {
//generate pdf
//save pdf
//attach pdf to email
//if commerical mail to mobile homes mhpublicassistance@mail.maricopa.gov
$mail = new PHPMailer();
$mail->IsSMTP(); // Set mailer to use SMTP
$mail->Host = 'mailbox.maricopa.gov'; // Specify main and backup server
$mail->SMTPAuth = false; // Enable SMTP authentication
$mail->From = 'dillonm@mail.maricopa.gov';
$mail->FromName = 'Maricopa County Assessor';
$mail->AddAddress(EMAIL_ADDRESS_504_FORM); // Add a recipient
$mail->AddBCC('dillonm@mail.maricopa.gov');
$mail->IsHTML(true);
$mail->AddAttachment();
$mail->Subject = "504 Request";
$mail->Body = 'Attached is a PDF copy of your request. A copy has also been sent to Maricopa County Assessor. Please allow 72 hours (3 business days) for the Assessor\'s Office to process your request. You will be contacted by phone or by email if we have questions regarding the information provided in your request. Once approved, the Tax Clearance will be emailed to you at the email address you\'ve provided. If you have any questions, please contact the Assessor\'s Office at 602-506-3291 or reply to this email.';
if(!$mail->Send()) {
print 'No Mail!!! ' . $mail->ErrorInfo;
}
//otherwise, mail to pubasst@mail.maricopa.gov
}
$mh = new MobileHomeRequest();
$mh->UpdateFromPost();
$id = $mh->SaveTempData();
Conf:
<?php
require_once('../../../../wp-load.php');
require_once('../includes/phpmailer/class.phpmailer.php');
require_once '../classes/504-send-request.php';
require_once ('../classes/pdf_generator.php');
$mh = new MobileHomeRequest();
$data = $mh->GetTempData($_POST['id']);
//print_r($data);
$data->SaveToDatabase();
pdf-generator.php
<?php
require_once('soap.php');
require_once('504-send-request.php');
require_once('/fpdf/fpdf.php');
//$mh = new MobileHomeRequest();
//$data = $mh->GetTempData($_POST['1']);
//$data = UpdateFromPost();
$pdf = new FPDF();
$pdf->AddPage();
$pdf->SetMargins(10, 10);
$pdf->SetAutoPageBreak(1, 10);
$pdf->SetFont('Arial', 'B', '20');
$pdf->Cell(0, 10, 'Mobile Home Poperty Tax Clearance Request', 0, 1);
$pdf->Ln();
$pdf->SetFont('Arial', 'B', '12');
$pdf->Cell(0, 10, 'This is a REQUEST. This is NOT a property tax clearance.', 0, 1);
$pdf->SetFont('Arial', '', '12');
//$pdf->MultiCell(0, 5, 'NOTE: PURSUANT TO ARS 42-19107 AND 42-19155, it is unlawful for any person to knowingly move or sell a mobile home for which applicable property taxes have not been paid. A person violating the provisions of the section is guilty of a class 1 Misdemeanor and is subject to a fine.', 0, 1);
$pdf->Ln();
$pdf->SetFont('Arial', '', 12);
$pdf->Cell(40, 5, 'Date Issued:');
$pdf->Cell(25, 5, date('m-d-Y'));
$pdf->SetTextColor(255,0,0);
$pdf->Cell(0, 5, '(VOID AFTER 30 DAYS)', 0, 1);