带有某个帖子值ID的页面显示找不到页面

时间:2019-09-06 作者:PratapAmitSingh

我已经自定义了模板,并使用POST方法向每个自定义页面发送了一些值。除最后一个自定义页面外,所有自定义页面都工作正常,我需要在其中插入带有邮件发送选项的数据。当我浏览页面时,它工作得很好,但不是用POST值。

我正在使用phpmailer进行邮件发送。

/** * Template Name: Download Page **/ session_start(); get_header(); /*

*/ include \'connect.php\'; if(isset($_POST[\'download\'])){ $psize = $_SESSION[\'psize\']; $size = $_SESSION[\'size\']; $name = $_POST[\'name\']; $mobile = $_POST[\'mobilephone\']; $email_id= $_POST[\'emailid\']; $size = $_SESSION[\'size\']; $ctprice = $_POST[\'ctprice\']; $appl = $_POST[\'appl\']; $appln = $_POST[\'appln\']; $image = stripslashes($_POST[\'image\']); $filenameID = date(\'mdYHis\') . mt_rand(6, 10); $total_sub1 = $size + $ctprice; // echo $total_sub1."
"; $total_sub2 =0; foreach($_POST[\'appl\'] as $field) { if($field == \'\') { echo "error - doesn\'t have a value"; } else { $total_sub2+=$field; } } $total = $total_sub1 + $total_sub2; // echo $total."
"; for ($i = 0; $i \'. $appln[$i].\' INR \'. $appl[$i].\' \'; //echo $Appliance; } } $filename = date(\'mdYHis\'); require_once "PHPMailer/src/PHPMailer.php"; //PHPMailer Object $mail = new PHPMailer\\PHPMailer\\PHPMailer(); //From email address and name $mail->From = "[email protected]"; $mail->FromName = "Customized Kitchen"; //To address and name $mail->addAddress($email_id, "Recepient Name"); $mail->addAddress($email_id); //Recipient name is optional //Address to which recipient will reply $mail->addReplyTo("[email protected]", "Reply"); //CC and BCC //$mail->addCC("[email protected]"); //$mail->addBCC("[email protected]"); //Send HTML or Plain Text email $mail->isHTML(true); $mail->Subject = \'Custom Kitchen\'; $mail->Body = \'Content\'; //$mail->AltBody = "This is the plain text version of the email content"; if(!$mail->send()) { // echo "Mailer Error: " . $mail->ErrorInfo; echo "Message has been failed"; echo \'

Somthing went wrong. Your customization is not Saved.

For customisation Visit here -> Customize

\'; } else { $sql = "INSERT INTO `enquiry`(`name`, `email`, `mobile`, `layout`,`fileID` ,`fileHTML`, `cost`, `total`) VALUES (\'$name\',\'$email_id\',\'$mobile\',\'$layout\',\'$filenameID\',\'$image\',\'$total_sub1\',\'$total\')"; // echo $sql; $result = $connect->query($sql); if($result){ $msg = "success"; echo "Message has been sent successfully"; } else { $msg = "failed"; echo "

Please Try Again

"; } } } /* */ if(isset($_GET[\'file\'])){ $file=$_GET[\'file\']; // echo $file; $sql_file = "SELECT `fileHTML` FROM `enquiry` WHERE `fileId`=\'$file\'"; // echo $sql_file; $res_file = $connect->query($sql_file); if ($res_file->num_rows > 0) { // output data of each row while($row_file = $res_file->fetch_assoc()){ // /* //
// Download */ } } } /*/

*/ get_footer();

1 个回复
SO网友:PratapAmitSingh

我已修复此问题。问题在变量$name中,而$name在wordpress中保留。所以我把它改成了$fname。现在它工作得很好。

相关推荐

Admin Theme customization

我遵循wordpress codex网站上关于通过插件创建管理主题的说明。我激活了插件,但我的样式表没有包含在<head>.. 这是我的代码:add_action( \'admin_init\', \'kd_plugin_admin_init\' ); add_action( \'admin_menu\', \'kd_plugin_admin_menu\' ); function kd_plugin_admin_init() { /* Register