dongyou2714 2015-10-08 15:55 采纳率: 0%
浏览 21

通过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条回答 默认 最新

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

    评论

报告相同问题?

悬赏问题

  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
  • ¥15 帮我写一个c++工程
  • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
  • ¥15 关于smbclient 库的使用
  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?