我需要幫助其被錯誤編碼我的PHP的聯繫表格PHP發送不工作電子郵件
HTML代碼:
<div id="contact_form" >
<form method="post" name="contact" action="contact.php">
<label for="author" style="font-size:14px;">Your Full Name:</label>
<input type="text" id="author" name="name" class="input_field" />
<div class="clear h20"></div>
<label for="email" style="font-size:14px;">Your Phone Number/Email:</label
<input type="text" id="email" name="email" class="input_field" />
<div class="clear h20"></div>
<label for="text" style="font-size:14px;">Message:</label>
<textarea id="text" name="comment" rows="0" cols="0" class="required"></textarea>
<div class="clear h20"></div>
<input style="font-size:16px;" type="submit" name="submit" value="Send" />
</form>
</div>
下面是加載形式CONTACT.PHP到HTML守則 PHP代碼:(contact.php)
<?php
if(isset($_POST['submit'])) {
$to = "[email protected]";
$subject = "Contact Us";
// data the visitor provided
$name_field = filter_var($_POST['name'], FILTER_SANITIZE_STRING);
$email_field = filter_var($_POST['email'], FILTER_VALIDATE_EMAIL);
$comment = filter_var($_POST['comment'], FILTER_SANITIZE_STRING);
//constructing the message
$body = " From: $name_field\n\n E-Mail: $email_field\n\n Message:\n\n $comment";
// ...and away we go!
mail($to, $subject, $body);
?>
您使用的是wamp還是Xamp?如果是的話,它是在線還是離線。你在哪裏發帖? –
PLZ任何人都可以在代碼中找到錯誤,因爲我不想更換整個編碼... plz guys – ThomasWeb
它在服務器上在線 – ThomasWeb