Ok I’m new to php coding and am working on a form mail php ( a form who’s content’s are mailed to an email address) the code works fine. Now I’d like to know if there’s a way to notify the visitors about the success or failure of the mail. ( dynamically add a line to the form page which mentions “success” or “failure try again”. Hope I’ve been clear enough.
Here’s the code
<?php
$name = $_POST["name"];
$company = $_POST["company"];
$email = $_POST["email"];
$contact =$_POST["contact"];
$require = $_POST["requirement"];
$message = "Name :".$name."\n"."Company :".$company."\n"."Email id".$email."\n"."Contact no :".$contact."\n"."Requirement : ".$require;
$subject ="Subject Matter Here";
$to = "abc@xyz.com";
if(mail($to, $subject,$message)){
echo "We Received Your enquiry, We'll get back to you soon";
}
else{
echo "there were some errors sending enquiry, please try again";
}
?>
The mail function: