dongou5100 2011-12-18 02:34
浏览 124
已采纳

为什么这个php联系表单只是下载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. basically all thats happening is the contact.php file is just getting downloaded to my computer. ugh. also, this client did not ask for any field validation, which is why theres none there. help!!

heres my 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
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
 E-Mail: $email_field
 Message:
 $message";

mail($to, $subject, $body);
} else {
echo "Sorry, something went wrong. Please email me at user@user.com.";
}
?>
  • 写回答

1条回答 默认 最新

  • drd94483 2011-12-19 08:23
    关注

    Ah, you guys are all right.

    tail -f /var/log/mail.log
    

    was helpful.
    And I am now using validate.js. Thanks guys!

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿
  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥15 stable diffusion
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘