私は PHP フォームを持っています。問題なく入力フィールドを受信していますが、電子メール クライアントに送信されていないように見える多くのオプション フィールドがあります。以下はHTMLコードとPHPスクリプトです..
どんな助けでも大歓迎です:)
みんなありがとう
<form action="/php/send-fast-action-form.php" method="post" name="form">
<div class="fast-action-details">
<input type="text" class="fast_form_name" name="fast_form_name" data-default="Full Name">
<input type="text" class="fast_form_address" name="fast_form_address" data-default="Address">
<input type="text" class="email" name="email" data-default="Postcode">
<input type="text" class="fast_form_landline" name="fast_form_landline" data-default="Landline">
<input type="text" class="fast_form_mobile" name="fast_form_mobile" data-default="Mobile">
<input type="text" class="fast_form_email" name="fast_form_email" data-default="Email">
<div class="fast-action-dropdown">
<select>
<option value="" disabled="disabled" selected="selected" class="property_type" name="property_type" data- default="Property Type">Property Type</option>
<option value="Detached">Detached</option>
<option value="Semi-Detached">Semi-Detached</option>
<option value="Mid-Terrace">Mid-Terrace</option>
<option value="End-Terrace">End-Terrace</option>
<option value="Apartment/Flat">Apartment/Flat</option>
<option value="Other">Other</option>
</select>
<select>
<option value="" disabled="disabled" selected="selected" class="number_of_rooms" name="number_of_rooms" data- default="Number of Bedrooms">Number of Bedrooms</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5+">5+</option>
</select>
</div>
<textarea class="fast_form_reason" name="fast_form_reason" data-default="Reason For Sale">
Reason For Sale
</textarea>
<div class="fast-action-send" onclick="form.submit()">Send</div>
</form>
<?php
if(isset($_POST['email'])) {
// CHANGE THE TWO LINES BELOW
$email_to = "your@example.com";
$email_subject = "Fast Action Form Response";
function changeValue(){
option document.getElementById('filter').value;
if(option=="A"){
document.getElementById('field').value="A Selected";
}
else if(option=="B"){
document.getElementById('field').value="B Selected";
}
}
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['fast_form_name']) ||
!isset($_POST['fast_form_address']) ||
!isset($_POST['email']) ||
!isset($_POST['fast_form_landline']) ||
!isset($_POST['fast_form_mobile']) ||
!isset($_POST['fast_form_email']) ||
!isset($_POST['fast_form_reason'])) {
died('We are sorry, but there appears to be a problem with the form you submitted.');
}
$fast_form_name = $_POST['fast_form_name'];
$fast_form_address = $_POST['fast_form_address'];
$email = $_POST['email'];
$fast_form_landline = $_POST['fast_form_landline'];
$fast_form_mobile = $_POST['fast_form_mobile'];
$email_from = $_POST['fast_form_email'];
$fast_form_reason = $_POST['fast_form_reason'];
$error_message = "";
$string_exp = "/^[A-Za-z .'-]+$/";
if(!preg_match($string_exp,$fast_form_name)) {
$error_message .= 'The Name you entered does not appear to be valid.<br />';
}
if(strlen($error_message) > 0) {
died($error_message);
}
$email_message = "A user has filled in the Sell And Move On - Fast Action Form, their details are below ..\n\n";
function clean_string($string) {
$bad = array("content-type","bcc:","to:","cc:","href");
return str_replace($bad,"",$string);
}
$email_message .= "Full Name: ".clean_string($fast_form_name)."\n";
$email_message .= "Address : ".clean_string($fast_form_address)."\n";
$email_message .= "Postcode: ".clean_string($email)."\n";
$email_message .= "Landline: ".clean_string($fast_form_landline)."\n";
$email_message .= "Mobile: ".clean_string($fast_form_mobile)."\n";
$email_message .= "Email: ".clean_string($email_from)."\n";
$email_message .= "Reason: ".clean_string($fast_form_reason)."\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);
?>
<!-- place your own success html below -->
Successfull HTML Here
<?php
}
die();
?>