--------------
if(empty($errors))
{
//send the email
$to = $your_email;
$subject="New form submission from website";
$from = $your_email;
$ip = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '';
$body = "A user $name submitted the contact form website:\n".
"Name: $name\n".
"Email: $visitor_email \n".
"Temat: $temat \n ".
"Message: \n ".
"$user_message\n".
"Message sent from IP: $ip\n";
if (!mail($to, $subject, $body)) {
die('ERROR');
} else {
header('Location: thank-you.html');
}
die();
---------------- oraz tutaj -----------
//Read an HTML message body from an external file, convert referenced images to embedded,
//convert HTML into a basic plain-text alternative body
$mail->msgHTML($body);
//Replace the plain text body with one created manually
//send the message, check for errors
if (!$mail->send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
die();
} else {
header('Location: thank-you.html');
}
W samym formularzu jest ukryty taki div wyświetlający ewentualne błędy walidacji
<td><!--ponizej php i div z bledami -->
<?php
if(!empty($errors)){
echo "<p class='err'>".nl2br($errors)."</p>";
}
?>
<div id='contact_form_errorloc' class='err'></div>
--------
Przeszukiwałem google lecz przykłady zastosowane przykłady nie działały. Chciałbym aby poniżej, albo w miejsce tego diva z błędami ukazywał się div z komunikatem o wysłaniu.
Może ktoś pomóc mi zamienić wyświetlanie strony thank-you.html i ewentualnego komunikatu o błędzie wysłania na wyświetlenie komunikatu w div.