试图修复代码。我在第 3、5 和 9 行拉错误。我很难过。看起来不错,但不是:/
<?php
if($_POST['submit']) {
if(empty($_POST['name']) || empty($_POST['email']) || empty($_POST[$_POST['comments'])) {
$error = true;
}else{
$to = "theloregame@gmail.com"
$name = trim($_POST['name']);
$email = trim($_POST['email']);
$comments = trim($_POST['comments']);
$subject = "Contact Form";
$messages = "name: $name \r\n Email: $email \r\n Comments: $comments";
$headers = "From:" . $name;
$mailesent = mail($to, $subject, $messages, $headers);
if($mailsclient) {
$sent = true;
}
}
}
?>