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