<?php
// Define some constants
define( "RECIPIENT_NAME", "John Doe" );
define( "RECIPIENT_EMAIL", "youremail@mail.com" );
// Read the form values
$success = false;
$userName = isset( $_POST['username'] ) ? preg_replace( "/[^\.\-\' a-zA-Z0-9]/", "", $_POST['username'] ) : "";
$senderEmail = isset( $_POST['email'] ) ? preg_replace( "/[^\.\-\' a-zA-Z0-9]/", "", $_POST['email'] ) : "";
$senderPhone = isset( $_POST['phone'] ) ? preg_replace( "/[^\.\-\' a-zA-Z0-9]/", "", $_POST['phone'] ) : "";
$message = isset( $_POST['message'] ) ? preg_replace( "/(From:|To:|BCC:|CC:|Message:|Content-Type:)/", "", $_POST['message'] ) : "";
// If all values exist, send the email
if ( $userName && $senderEmail && $senderPhone && $message) {
$recipient = RECIPIENT_NAME . " <" . RECIPIENT_EMAIL . ">";
$headers = "From: " . $username . " <" . $senderEmail . ">";
$msgBody = " Phone: " . $senderPhone . " Message: " . $message . "";
$success = mail( $recipient, $headers, $msgBody );
//Set Location After Successsfull Submission
header('Location: contact.html?message=Successfull');
}
else{
//Set Location After Unsuccesssfull Submission
header('Location: index.html?message=Failed');
}
?>
DTcode7
- 粉丝: 3w+
- 资源: 4986
最新资源
- libtnc-1.25-6.el7.x64-86.rpm.tar.gz
- libtnc-devel-1.25-6.el7.x64-86.rpm.tar.gz
- libtomcrypt-1.17-26.el7.x64-86.rpm.tar.gz
- libtomcrypt-devel-1.17-26.el7.x64-86.rpm.tar.gz
- libtomcrypt-doc-1.17-26.el7.x64-86.rpm.tar.gz
- libtommath-0.42.0-6.el7.x64-86.rpm.tar.gz
- libtommath-devel-0.42.0-6.el7.x64-86.rpm.tar.gz
- libtommath-doc-0.42.0-6.el7.x64-86.rpm.tar.gz
- libtool-2.4.2-22.el7-3.x64-86.rpm.tar.gz
- libtool-ltdl-2.4.2-22.el7-3.x64-86.rpm.tar.gz
- libtool-ltdl-devel-2.4.2-22.el7-3.x64-86.rpm.tar.gz
- libtranslit-0.0.2-6.el7.x64-86.rpm.tar.gz
- libtranslit-devel-0.0.2-6.el7.x64-86.rpm.tar.gz
- libtranslit-icu-0.0.2-6.el7.x64-86.rpm.tar.gz
- libtranslit-m17n-0.0.2-6.el7.x64-86.rpm.tar.gz
- libtsan-4.8.5-44.el7.x64-86.rpm.tar.gz
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈