私のPHPメーリングコードが常に次のようになるのはなぜですか?
構文エラー、4行目のC:\ xampp \ htdocs \ GSP \ members.phpに予期しない'ÂÂÂÂ'(T_STRING)
<?php
if(!isset($_POST['email'])) {
$email_to = 'kennydharmawan@gmail.com'; //this is line 4
$email_subject = "GSP Rent Order";
function died($error) {
// your error code can go here
echo "We are very sorry, but there were error(s) found with the form you submitted. ";
echo "These errors appear below.<br /><br />";
echo $error."<br /><br />";
echo "Please go back and fix these errors.<br /><br />";
die();
}
// validation expected data exists
if(!isset($_POST['name']) ||
!isset($_POST['email']) ||
!isset($_POST['unit']) ||
!isset($_POST['startdate']) ||
!isset($_POST['enddate']) ||
!isset($_POST['telephone']) ||
!isset($_POST['rname']) ||
!isset($_POST['city']) ||
!isset($_POST['adress'])) {
died('We are sorry, but there appears to be a problem with the form you submitted.');
}
$name = $_POST['name'];
$email_from = $_POST['email'];
$unit = $_POST['unit'];
$startdate = $_POST['startdate'];
$enddate = $_POST['enddate'];
$telephone = $_POST['telephone'];
$rname = $_POST['rname'];
$city = $_POST['city'];
$adress = $_POST['adress'];
$error_message = "";
$email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
if(!preg_match($email_exp,$email_from)) {
$error_message .= 'The Email Address you entered does not appear to be valid.<br />';
}
$string_exp = "/^[A-Za-z .'-]+$/";
$phone_exp = "/^[1-9][0-9]{0,15}$/";
if(!preg_match($string_exp,$name)) {
$error_message .= 'The Name you entered does not appear to be valid.<br />';
}
if(!preg_match($string_exp,$rname)) {
$error_message .= 'The Recipient Name you entered does not appear to be valid.<br />';
}
if(!preg_match($string_exp,$city)) {
$error_message .= 'The City you entered does not appear to be valid.<br />';
}
if(!preg_match($phone_exp,$telephone)) {
$error_message .= 'The Phone Number you entered does not appear to be valid.<br />';
}
if(strlen($adress) < 2) {
$error_message .= 'The Adress you entered do not appear to be valid.<br />';
}
list($dd,$mm,$yyyy) = explode('/',$startdate);
if (!checkdate($mm,$dd,$yyyy)) {
$error_message .= 'The Start Date you entered do not appear to be valid.<br />';
}
list($dd,$mm,$yyyy) = explode('/',$enddate);
if (!checkdate($mm,$dd,$yyyy)) {
$error_message .= 'The End Date you entered do not appear to be valid.<br />';
}
if(strlen($error_message) > 0) {
died($error_message);
}
$email_message = "Form details below.\n\n";
function clean_string($string) {
$bad = array("content-type","bcc:","to:","cc:","href");
return str_replace($bad,"",$string);
}
$email_message .= "Name: ".clean_string($name)."\n";
$email_message .= "Email: ".clean_string($email_from)."\n";
$email_message .= "Unit: ".clean_string($unit)."\n";
$email_message .= "Start Date: ".clean_string($startdate)."\n";
$email_message .= "End Date: ".clean_string($enddate)."\n";
$email_message .= "Telephone Number: ".clean_string($telephone)."\n";
$email_message .= "Recipient Name: ".clean_string($rname)."\n";
$email_message .= "Recipient City: ".clean_string($city)."\n";
$email_message .= "Recipient Adress: ".clean_string($adress)."\n";
// create email headers
$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion();
@mail($email_to, $email_subject, $email_message, $headers);
echo "Thank you for contacting us. We will be in touch with you very soon."
}
?>
なぜいつもこのエラーを言い続けるのですか?