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 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?
  • ¥15 乘性高斯噪声在深度学习网络中的应用
  • ¥15 运筹学排序问题中的在线排序
  • ¥15 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决
  • ¥30 求一段fortran代码用IVF编译运行的结果
  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛