简体   繁体   English

为什么此php联系人表格仅下载contact.php?

[英]why does this php contact form just download contact.php?

i'm a total n00b when it comes to PHP (and arguably, web development in general :/), but i've taken a look at a ton of examples, comparing my code, and i just can't figure it out. 当涉及到PHP时(我可以说是一般的Web开发:/),我的总成绩为n00b,但是我看了很多示例,比较了我的代码,但我无法弄清楚。 basically all thats happening is the contact.php file is just getting downloaded to my computer. 基本上所有发生的事情就是contact.php文件刚刚下载到我的计算机上。 ugh. 啊。 also, this client did not ask for any field validation, which is why theres none there. 另外,该客户没有要求任何现场验证,这就是为什么那里没有验证的原因。 help!! 救命!!

heres my html- 这是我的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>        

and the php- 和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.";
}
?>

Ah, you guys are all right. 啊,你们还好。

tail -f /var/log/mail.log

was helpful. 是有帮助的。
And I am now using validate.js . 我现在正在使用validate.js Thanks guys! 多谢你们!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM