I am try to put the finishing touches to a mail function, and would like to show an alert to tell the user the form has been submitted correctly. I would then like to redirect them to another page in the site.
The alert works OK on its own, but when I add a header to redirect, the redirect is OK but the alert does not work.....my code is below please help.
<?php
$ok = @mail($email_to, $email_subject, $email_message, $headers);
if($ok) {
echo "<script language='javascript'>";
echo "alert('Thank You!! Your booking has been made successfuly. To CANCEL please call xxx)";
echo "</script>";
echo header('Location:home.htm');
}else {
echo "<script language='javascript'>";
echo "alert('SORRY! A technical error has occurred, please Call xx to make your booking')";
echo "</script>";
}
?>