The script does run, and I get the email. None of the information in the variables appears in the message, though. I get the plain text (“Query from” in the subject and “From” in the body). I have pasted the PHP script and the HTML form below. I would love to use PHPMail, but I don’t know if it is in the hosting environment I use, and I cannot install it myself. Until I can find out, I am using the native mail() function. Thanks in advance.
PHP Code
<?php $to = "[email protected]";
$subject = "Query from" . htmlspecialchars($_POST['customer']);
$msgBody = htmlspecialchars($_POST['msgBody']) . " From: ";
$from = htmlspecialchars($_POST['subAdd']); $message = $from . " " . $msgBody;
if (mail($to, $subject, $message)){
header("Location: https://bkjdesignspa.com");
}
else{
echo "<script>window.alert('There was a problem sending the message.')</script>";
}
?>
HTML form
<form id="contactInfo" method="post" action="contactForm.php">
<label>Name</label><br>
<input type="text" placeholder="Name" required><br>
<label>Email</label><br>
<input type="email" id="subAdd" placeholder="Email Address" required><br>
<label>Details</label><br>
<textarea id="msgBody" placeholder="Details of request" style="width: 10em; height: 5em;" required></textarea><br> <input type="submit" value="Submit">
</form><br>