I have a web form that was emailing itself multiple times if someone clicked the submit button more than once.
In the form, I added:
$_SESSION["EmailSent"] = 0;
On the processing page I added:
if ($_SESSION["EmailSent"] == 0){
$_SESSION["EmailSent"] = 1;
if(!$mail->send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
}
else {
//echo 'Message has been sent';
}
}
On the processing page, I'm getting the error: PHP Notice: Undefined index: EmailSent
I added session_start( ) to the top of the pages. The weird thing is that the email is still being sent and not stopped when the page encounters the error.