dtkf64283 2014-11-30 05:46
浏览 44
已采纳

Bootstrap联系表单不是-php函数

I had coded html and php but cloudsblack84@gmail.com(mail address) still cannot receive mail form my website ( http://cloudsblack.info/ ) and at the end when I clicked the submit button will go into blank page (http://cloudsblack.info/index.php) . Sorry I am just beginner on web design need to learn a lot from you guys .

HTML PART

    <!-- Contact Section -->
<section id="contact" class="contacts-section">
    <div class="container content-lg">
        <div class="title-v1">
            <h2>Contact Us</h2>
            <p>I'm always happy to hear from you. Please contact or email me for appointment or service enquiry.</p>
        </div>

        <div class="row contacts-in">
            <div class="col-md-6 md-margin-bottom-40">
                <ul class="list-unstyled">
                    <li><i class="fa fa-home"></i> Kuala Lumpur</li>
                    <li><i class="fa fa-phone"></i> (6)016-7187764</li>
                    <li><i class="fa fa-envelope"></i> <a href="-removed-email-">-removed-email-</a></li>
                </ul>
            </div>

            <div class="col-md-6">
                 <form method="post" action="index.php">
                    <label>Name</label>
                    <div class="row margin-bottom-20">
                        <div class="col-md-7 col-md-offset-0">
                            <input type="text" name="name" class="form-control">
                        </div>                
                    </div>

                    <label>Email<span class="color-red">*</span></label>
                    <div class="row margin-bottom-20">
                        <div class="col-md-7 col-md-offset-0">
                            <input type="text" name="email" class="form-control">
                        </div>                
                    </div>

                    <label>City</label>
                    <div class="row margin-bottom-20">
                        <div class="col-md-7 col-md-offset-0">
                            <input type="text" name="city" class="form-control">
                        </div>                
                    </div>

                    <label>Telephone</label>
                    <div class="row margin-bottom-20">
                        <div class="col-md-7 col-md-offset-0">
                            <input type="text" name="telephone" class="form-control">
                        </div>                
                    </div>


                    <label>Interested</label>
                    <div class="row margin-bottom-20">
                        <div class="col-md-7 col-md-offset-0">
                            <input type="text" name="interested" class="form-control">
                        </div>                
                    </div>

                    <label>Message</label>
                    <div class="row margin-bottom-20">
                        <div class="col-md-11 col-md-offset-0">
                            <textarea rows="8" name="message" class="form-control"></textarea>
                        </div>                
                    </div>

                    <p><button type="submit" name="submit" class="btn-u btn-brd btn-brd-hover btn-u-dark">Send Message</button></p>
                </form> 
            </div>
        </div>            
    </div>

PHP PART

<?php
$name = $_POST['name'];
$email = $_POST['email'];
$city = $_POST['city'];
$telephone = $_POST['telephone'];
$interested = $_POST['interested'];
$message = $_POST['message'];
$submit = $_POST['submit'];

if($submit){

$from = 'From: -removed-domain-'."
"; 
$to = '-removed-email-'; 
$subject = "Message from -removed-domain-";
$body = "".
    "From: ".$name."
".
    "E-mail: ".$email."
".
    "City: ".$city."
".
    "Telephone: ".$telephone."
".
    "Interested: ".$interested."
".
    "Message: ".$message."
";

if(mail($to, $subject, $body, $from)){
    echo '<p>Your message has been sent!</p>';
}
else{
    die('<p>Something went wrong, go back and try again!</p>'); 
}
}
?>
  • 写回答

1条回答 默认 最新

  • doudeng2016 2014-11-30 05:58
    关注

    If you see the message Something went wrong, go back and try again! your mail server is incorrectly configured within php.ini or it has timed-out

    If you see Your message has been sent!, check your spam folder.

    If all else fails, access your mail server logs through WHM or CPanel or contact your hosting provider


    $submit = $_POST['submit'];

    You havn't given the <button name='submit'> a value, if($submit){ is false/non-existent in your POST data.


    Still not a reason for the blank page, need to look at your apache/php error logs or ask your hosting provider.

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

报告相同问题?

悬赏问题

  • ¥20 求一个html代码,有偿
  • ¥100 关于使用MATLAB中copularnd函数的问题
  • ¥20 在虚拟机的pycharm上
  • ¥15 jupyterthemes 设置完毕后没有效果
  • ¥15 matlab图像高斯低通滤波
  • ¥15 针对曲面部件的制孔路径规划,大家有什么思路吗
  • ¥15 钢筋实图交点识别,机器视觉代码
  • ¥15 如何在Linux系统中,但是在window系统上idea里面可以正常运行?(相关搜索:jar包)
  • ¥50 400g qsfp 光模块iphy方案
  • ¥15 两块ADC0804用proteus仿真时,出现异常