0
<?php
if (isset($_POST["sendMessage"])) {
$firstName = trim($_POST['firstName']);
$lastName = trim($_POST['lastName']);
$email = trim($_POST['email']);
$phone = trim($_POST['phone']);
$message = trim($_POST['message']);
$from = '[email protected]';
$to = '[email protected]';
$subject = '[email protected]';
$txt = 'Prottyasha School';
$headers = "From: [email protected]" . "\r\n" .
"CC: [email protected]";
$body = "From: First-Name: $firstName\n Last-Name: $lastName\n
E-Mail: $email\n Phone: $phone\n Message: $message";
//echo "success?";
if (mail($to, $subject, $body, $headers)) {
$result = '<div class="alert alert-success">Thank You! I will be in touch</div>';
} else {
$result = '<div class="alert alert-danger">Sorry there was an error sending your message. Please try again later</div>';
}
echo $result;
}
?>
它工作正常,但我想使其驗證。假設有人給出了無效的電話號碼或電子郵件,那麼它會發送無效的郵件或電話號碼。我想讓它充分驗證。任何人都請幫助我。驗證完整聯繫頁面
看看[https://www.tutorialspoint.com/php/php_validation_example.htm] –
它顯示頁面未找到。你會再請檢查一次嗎? – Farjana
請檢查更正的網址 –