so im trying to make two separate forms that will create PDF file via FPD(fpdf.org)
Heres what i've got so far, basically it creates two files as it should, but when im using one form the data from the other one disappears
heres the code
add_action('wpcf7_before_send_mail', 'wpcf7_update_email_body');
function wpcf7_update_email_body($contact_form) {
$submission = WPCF7_Submission::get_instance();
if ( $submission ) {
/* load fpdf */
define ('FPDF_PATH',get_template_directory().'/tfpdf/');
require(FPDF_PATH.'tfpdf.php');
$posted_data = $submission->get_posted_data();
// save data as vars
$podpis = $posted_data["podpis"];
$kreska = "........";
$pdf = new tFPDF();
$pdf->AddPage();
$pdf->SetFont('Arial','B',16);
$pdf->Write(3, $podpis . "
" . $kreska );
$pdf->Output(FPDF_PATH.'podpis.pdf', 'F'); // save podpis.pdf
}
if ($submission ) { // this is where it fucks up i guess
// save data as vars
$umowa = $posted_data["umowa"];
$pdf = new tFPDF();
$pdf->AddPage();
$pdf->SetFont('Arial','B',16);
$pdf->Write(3, $umowa );
$pdf->Output(FPDF_PATH.'umowa.pdf', 'F'); // save umowa.pdf
}
}
How do i solve that problem?
You should try to send the data of the two forms when one is submitted, and send back to the view the data of the unsubmitted form and load it in the inputs. Just like when you validates data on the server side (with PHP).