dousonghs58612 2019-02-13 06:15
浏览 73

提交表单信息时为什么会出现空白屏幕? [重复]

This question already has an answer here:

I've been struggling with this form function for the past couple of days and I'm close to having it done! When I click the submit button I just get a blank white screen instead of a pop up of a thank you note and I also dont get an email as I should so I know something is off.

ive tried isset() and messing around with xampp but now I have the site being hosted and I'm running into the white screen

This is the php

    <?php 

use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;

require 'path/to/PHPMailer/src/Exception.php';
require 'path/to/PHPMailer/src/PHPMailer.php';
require 'path/to/PHPMailer/src/SMTP.php';


$DATE = htmlspecialchars($_POST['DATE']);
$TIME = htmlspecialchars($_POST['TIME']);
$NAME = htmlspecialchars($_POST['NAME']);
$ORDER = htmlspecialchars($_POST['ORDER']);
$EMAIL = htmlspecialchars($_POST['EMAIL']);

$mail = new PHPMailer;

$mail->From = "$EMAIL";
$mail->FromName = "$NAME";

$mail->addAddress("ric*****@gmail.com"); 

$mail->isHTML(true);

$mail->Subject = "Subject Text";
$mail->Body = "$DATE $TIME 
 $NAME 
 $ORDER";
$mail->AltBody = "This is the plain text version of the email content";

if(!$mail->send()) 
{
    echo "Mailer Error: " . $mail->ErrorInfo;
} 
else 
{
    echo "Message has been sent successfully";
}
?>

I want the pop up contact message to appear and an email received to the one listed

</div>
  • 写回答

1条回答 默认 最新

  • dongqintong8972 2019-02-13 09:27
    关注

    Sorry I don't have enough reputation to comment yet.

    A blank page could be the sign of an uncaught Exception: http://php.net/manual/en/language.exceptions.php

    try to catch it and var_dump it (page above has samples)

       try {
        //code here
       } catch (\Exception $e) {
        var_dump($e->getMessage());
       }
    

    This will catch any Exception, in this case for debugging I think that is what you want.

    Error should appear in your logs as well.

    评论

报告相同问题?

悬赏问题

  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么