我已经尝试了所有我能想到的东西,但由于我对交互式表格并不熟悉,所以我已经走到了尽头。我希望你能帮助我。
这是我的HTML
<div class="form-container">
<div class="response"></div>
<form class="forms" action="contact/form-handler.php" method="post">
<fieldset>
<ol>
<li class="form-row text-input-row">
<label>Name</label>
<input type="text" name="name" value="" class="text-input required" title="" />
</li>
<li class="form-row text-input-row">
<label>Email</label>
<input type="text" name="email" value="" class="text-input required email" title="" />
</li>
<li class="form-row text-input-row">
<label>Subject</label>
<input type="text" name="subject" value="" class="text-input required" title="" />
</li>
<li class="form-row text-area-row">
<label>Message</label>
<textarea name="message" class="text-area required"></textarea>
</li>
<li class="form-row hidden-row">
<input type="hidden" name="hidden" value="" />
</li>
<li class="button-row">
<input type="submit" value="Submit" name="submit" class="btn-submit light" />
</li>
</ol>
<input type="hidden" name="v_error" id="v-error" value="Required" />
<input type="hidden" name="v_email" id="v-email" value="Enter a valid email" />
</fieldset>
</form>
</div>
这是我的php
<?php
$name = $_POST['name'];
$visitor_email = $_POST['email'];
$subject = $_POST['subject'];
$message = $_POST['message'];
$email_from = 'sender@sendermail.com';//<== update the email address
$email_subject = "$subject";
$email_body = "You have received a new message from the user $name.\n".
"Here is the message:\n $message".
$to = "receiver@receivermail.com";//<== update the email address
$headers = "From: $email_from \r\n";
$headers .= "Reply-To: $visitor_email \r\n";
//Send the email!
mail($to,$email_subject,$email_body,$headers);
// Function to validate against any email injection attempts
function IsInjected($str)
{
$injections = array('(\n+)',
'(\r+)',
'(\t+)',
'(%0A+)',
'(%0D+)',
'(%08+)',
'(%09+)'
);
$inject = join('|', $injections);
$inject = "/$inject/i";
if(preg_match($inject,$str))
{
return true;
}
else
{
return false;
}
}
?>
任何想法导致了什么?