I am trying to send a mail from a contact form in my website and when it's successfully sent I want to display a success message but the success message shows all the time ,what's a fix for this?
<?php
$bussiness = $_POST['contact[Business Name]'];
$ownername = $_POST['ownername'];
$buyername = $_POST['buyername'];
$address = $_POST['address'];
$city = $_POST['city'];
$state = $_POST['state'];
$zipcode = $_POST['zipcode'];
$phone = $_POST['phone'];
$email = $_POST['email'];
$yib = $_POST['yib'];
$nroe = $_POST['nroe'];
$nol = $_POST['nol'];
$taxid = $_POST['taxid'];
$resalelicense = $_POST['resalelicense'];
$productlines = $_POST['productlines'];
$retailerlist = $_POST['retailerlist'];
$formcontent=" From: $bussiness \n OwnerName: $ownername \n Buyer name: $buyername \n Address: $address \n City: $city \n State: $state \n Zip Code: $zipcode \n Phone: $phone \n Email: $email \n Years in bussiness: $yib \n Number of employees : $nroe \n Number of locations: $nol \n Tax ID: $taxid \n Resale license : $resalelicense \n Product lines: $productlines \n Retailer list: $retailerlist ";
$recipient = "agonramizi@gmail.com";
$subject = "Contact Form";
$mailheader = "From: $email \r\n";
if(mail($recipient, $subject, $formcontent, $mailheader)) {
echo "Thank you, your message has been recieved!";
}else {
echo "Sorry, there was an error sending your message!";
}
?>
and my html is below,I want to fix it so it only shows the message after it sends the email , here is my website http://hip-products.rogsiteworks.com/contact.php
Thank you