テストしてみると、 と表示されますThank you for contacting.....
。メールをチェックしても何も送信されず*$@
、エラーチェックを入力しても無視されているようです
フォーム
<h2 class="title"></h2>
<p> </p>
<br />
Please fill out all info below<br /><br />
<form name="Membership Application" action="mailscript.php" method="post">
<table border="1">
<tr>
<td><label for="Name">Name</label></td>
<td width="204"><input type="text" width="200" Name="Name" /> </td>
</tr>
<TR>
<TD><input type="submit" name="submit" value="Submit" /></TD>
</TR>
</table>
</form>
PHP
<?php
if(isset($_POST['email'])) {
$email_to = "user@user.com";
$email_subject = "Test";
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'])) {
died('We are sorry, but there appears to be a problem with the form you submitted.');
}
$Name = $_POST['Name']; //required
$error_message = "";
$string_exp = "/^[A-Za-z .'-]+$/";
//The Error Cheak
if(!preg_match($string_exp,$Name)) {
$error_message .= 'The Name you entered does 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";
// create email headers
$headers = 'From: '.$Name."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion();
@mail($email_to, $email_subject, $email_message, $headers);
?>
<!-- include your own success html here -->
Thank you for contacting us. We will be in touch with you very soon.
記入が必要な情報フィールドはあと 7 つありますが、1 つに減らしました。