PHP alert message help

Hi all, I downloaded the php files from ‘A Nice & Simple Contact Form’. I manipulated the main file to my needs at http://www.carpescience.com. Contact form works perfectly, but… how can I pop an alert up instead to relink to ‘contactthanks.php’ and ‘error.htm’ at:

// send email
$success = mail($EmailTo, $Subject, $Body, “From: <$EmailFrom>”);

// redirect to success page
if ($success){
print “<meta http-equiv=“refresh” content=“0;URL=contactthanks.php”>”;
}
else{
print “<meta http-equiv=“refresh” content=“0;URL=error.htm”>”;
}

I wanna make it really simple and I read about make alerts with echo or print commands and div, but I’m struggling with html and php surpasses me… I have no clear if a js sentence is needed for that. Now there is an html alert that thanks anyway if message its sent right or wrong…

I’ll REALLY appreciate any help. Thanks in advance

Best

I am against the use of the mail() function, but:

// send email
$success = mail($EmailTo, $Subject, $Body, "From:<$EmailFrom>");

// redirect to success page
if ($success){
    $msg = "Your message was sent!";
}
else{
    $msg = "Error sending the email";
}
echo "<script>alert({$msg});</script>";

Thank you so much, its a temporal situation.

Sponsor our Newsletter | Privacy Policy | Terms of Service