Files
demo_sites/templates/template_4/site/contact.php
2026-05-17 18:29:30 -05:00

29 lines
858 B
PHP

<?php
function parseInput($data) {
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}
if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['email']) && isset($_POST['content'])) {
$to_email = 'noreply@createwebsites.pl';
$user_email = parseInput($_POST['email']);
$content = parseInput($_POST["content"]);
$subject = "a user has completed the contact form";
$body = "<p>a user (<a href=\"mailto:$user_email\">$user_email</a>) has completed the contact form:</p><p>\"$content\"</p>";
$header.= "MIME-Version: 1.0\r\n";
$header.= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$header.= "X-Priority: 1\r\n";
if ( mail($to_email, $subject, $body, $header)) {
echo("success");
} else {
echo("fail");
}
} else {
echo ("email and content cannot be empty");
}
?>