ok
Direktori : /home/importfo/www/abaestheticanddentalclinic.com/ |
Current File : /home/importfo/www/abaestheticanddentalclinic.com/inquiry.php |
<?php include("admin/config.php"); if(isset($_POST['submit'])) { error_reporting(0); $name=$_POST['name']; $email=$_POST['email']; $contact=$_POST['contact']; $message=$_POST['msg']; $sql="INSERT INTO `contact`( `name`, `email`, `contact`, `message`) VALUES ('$name','$email','$contact','$message')"; $result=mysqli_query($db,$sql); if($result==1) { $to = "info@abaestheticanddentalclinic.com"; $subject = "Website Enquiry Detail"; $message .= "<h4>Name : $name</h4>"; $message .= "<h4>Email : $email </h4>"; $message .= "<h4>Contact : $contact </h4>"; // $message .= "<h4>Subject : $subject </h4>"; $message .= "<h4>Message : $message </h4>"; $header = "From:$email \r\n"; /*$header .= "Cc:inddigmedia@gmail.com\r\n";*/ $header .= "MIME-Version: 1.0\r\n"; $header .= "Content-type: text/html\r\n"; $retval = mail ($to,$subject,$message,$header); if( $retval == true ) { echo ("<script LANGUAGE='JavaScript'>window.location.href='price.php';</script>"); /*echo "email send sucessfully";*/ } } else { echo "Email Could Not Send.!"; } } ?> <?php if ($_SERVER["REQUEST_METHOD"] == "POST") { // Collect form data $name = htmlspecialchars($_POST['name']); $email = htmlspecialchars($_POST['email']); $contact = htmlspecialchars($_POST['contact']); $message = htmlspecialchars($_POST['msg']); // Validate email if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { header("Location: index.php?error=invalid_email"); exit; } // Email parameters $to = "development@inddigmedia.com"; // Replace with your recipient email address $subject = "Appointment from Your Website"; $headers = "From: " . $email . "\r\n"; $headers .= "Reply-To: " . $email . "\r\n"; $headers .= "Content-type: text/html\r\n"; // Email body $emailBody = " <h2>Inquiry Form Submission</h2> <p><strong>Name:</strong> $name</p> <p><strong>Email:</strong> $email</p> <p><strong>Contact:</strong> $contact</p> <p><strong>Message:</strong> $message</p> "; // Send email if (mail($to, $subject, $emailBody, $headers)) { header("Location: price.php?success=1"); } else { header("Location: index.php?error=mail_failed"); } } else { header("Location: index.php?error=invalid_request"); } exit; ?>