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
请检查更正的网址 –