dongluoqiu0255 2015-10-08 15:55
浏览 17

通过ftpf将两个单独的表单保存为pdf

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?

  • 写回答

1条回答 默认 最新

  • douduan3203 2015-10-08 16:23
    关注

    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).

    评论

报告相同问题?

悬赏问题

  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 正弦信号发生器串并联电路电阻无法保持同步怎么办
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 个人网站被恶意大量访问,怎么办
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)