为什么这个PHP联系人表单只下载contact. PHP ?


why does this php contact form just download contact.php?

我完全不懂PHP(可以说,一般的web开发:/),但是我已经看了大量的例子,比较了我的代码,我就是不明白。基本上所有发生的就是contact。php文件被下载到我的电脑上。啊。而且,这个客户端没有要求任何字段验证,这就是为什么那里没有字段验证的原因。帮助! !

我的html-

<form action="contact.php" method="post">
                <fieldset>
                  <legend><strong>Get A Quote!</strong>
                  </legend>
                   Call me at 555-555-5555, or email me at <a href="">email@emaiul.com</a>, or use the form below.<br /><br />
                    <div class="clearfix">
                        <div class="input">
                          <input style="width:370px; height:35px; font-size:14px;" value="Name"  name="name" size="50"  type="text">
                        </div>
                    </div><!-- /clearfix -->
                    <div class="clearfix">
                        <div class="input">
                         <input style="width:370px; height:35px; font-size:14px;" value="Email"  name="email" size="50"  type="text">
                        </div>
                    </div><!-- /clearfix -->
                    <div class="clearfix">
                        <div class="input">
                          <input style="width:370px; height:35px; font-size:14px;" value="Phone"  name="phone" size="50"  type="text">
                        </div>
                    </div><!-- /clearfix -->
                    <div class="clearfix">
                        <div class="input">
                         <textarea style="width:370px; height:55px; font-size:14px;"  name="message" size="50"  type="text">Message</textarea>
                        </div>
                    </div><!-- /clearfix -->
                </fieldset>
                  <button type="submit" name="saveForm" style="background-image: url(static/img/btn-submit.png); width:150px; height:37px;"></button>
              </form>        

和php-

<?php
if(isset($_POST['saveForm'])) {
$to = "steven@urethrafranklin.org";
$subject = "Inquiry from website";
$name_field = $_POST['name'];
$email_field = $_POST['email'];
$phone_field = $_POST['phone'];
$message = $_POST['message'];
$body = "From: $name_field'n E-Mail: $email_field'n Message:'n $message";
mail($to, $subject, $body);
} else {
echo "Sorry, something went wrong. Please email me at user@user.com.";
}
?>

啊,你们都很好。

tail -f /var/log/mail.log

是有帮助的。我现在用的是validate.js。谢谢你们了!