...
if (emailformat($email)){
mail ($to, $subject, $mess, $extra);
}
else{
echo "<script>history.back();</script>";
}
ดูให้หน่อยครับ ตัวหนาสีเเดงคือฟังก์ชันที่เพิ่มเข้าไปตรวจสอบเมล์
แต่ว่ามันไม่ทํางาน ไม่ยอมตรวจสอบให้ ไม่ทราบผิดตรงไหนครับ
<?php
if ( isset($_POST) ) {
foreach ( $_POST as $a => $b ) {
${$a} = $b;
}
}
function emailformat($email){
if (eregi("^[_a-z0-9-] (.[_a-z0-9-] )*@[a-z0-9-] (.[a-z0-9-] )*(.[a-z]{2,3})$", $email)){
return true;
}else{
return false;
}
} if(strstr($email,"
")){
die("Message could not be send, because it's probably spam.");
}else{
$to = "
[email protected]";
$subject = "SUBJECT";
$extra = "From: $email";
$mess =
"
Name: ".$name.
"
Email: ".$email.
"
Country: ".$Country.
"
Surname: ".$Surname.
"
Number: ".$Number.
"
Shop: ".$Shop.
"
Address: ".$Address.
"
Message: ".$message."";
mail ($to, $subject, $mess, $extra);
include "thankyou.html";
}
?>