问题描述
这是我正在处理的表格:http://www.starpediatrics.com/delete/form/
我在Worpress中有一个使用ContactForm 7插件创建的表单。用户提交信息时,它将生成包含所有数据的HTML,然后使用库HTML2PDF创建PDF。 PDF随附在提交文件中,并通过电子邮件发送给管理员。
我想向表单添加一个字段:LicenseAuthority。因此,我执行以下操作:
1-在我的FUNCTIONS.PHP文件中,我添加了如下字段:
function save_application_form($cf7) {
require_once(TEMPLATEPATH.'/includes/formData.PHP');
$submission = WPCF7_Submission::get_instance();
$data =& $submission->get_posted_data();
$dt->setLicenseauthority($data['licenseissuingauthority']);
ob_start();
include(TEMPLATEPATH.'/includes/form.PHP');
$content = ob_get_clean();
require(TEMPLATEPATH.'/includes/html2pdf/html2pdf.class.PHP');
try
{
$html2pdf = new HTML2PDF('P','LETTER','fr');
$html2pdf->pdf->IncludeJS("print(true);");
$html2pdf->writeHTML($content,isset($_GET['vuehtml']));
$fileName = 'form-'.uniqid().'-pdf.pdf';
$html2pdf->Output(TEMPLATEPATH."/files/$fileName",'F');
}
catch(HTML2PDF_exception $e) {
echo $e;
exit;
}
/* add the pdf as attach to the email*/
$cf7['attachments'][] = TEMPLATEPATH."/files/$fileName";
return $cf7;
}
<?PHP
class FormData {
private $licenseauthority;
public function setLicenseauthority($licenseauthority) {
$this->licenseauthority = $licenseauthority;
}
public function getLicenseauthority() {
return $this->$licenseauthority;
}
?>
3-然后,在FORM.PHP文件中,显示联系表单中的字段,如下所示:
<td>License Authority: <?PHP echo $dt->getLicenseauthority(); ?></td>
提交表单后,这足以创建PDF。不幸的是,当我单击“发送”时,它永远不会发送提交。它一直在加载,但什么也没发生。
我的代码有问题吗?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)