引导联系形式不是函数 -php


Bootstrap contact form not function -php

我已经编写了html和php,但 cloudsblack84@gmail.com(邮件地址)仍然无法从我的网站接收邮件(http://cloudsblack.info/),最后当我单击提交按钮时,将进入空白页(http://cloudsblack.info/index.php)。对不起,我只是网页设计的初学者,需要从你们那里学到很多东西。

网页部分

    <!-- 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部分

<?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-'."'r'n"; 
$to = '-removed-email-'; 
$subject = "Message from -removed-domain-";
$body = "".
    "From: ".$name."'n".
    "E-mail: ".$email."'n".
    "City: ".$city."'n".
    "Telephone: ".$telephone."'n".
    "Interested: ".$interested."'n".
    "Message: ".$message."'n";
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>'); 
}
}
?>

如果您看到邮件Something went wrong, go back and try again!邮件服务器在php.ini内配置不正确或已超时

的邮件

如果您看到Your message has been sent!,请检查您的垃圾邮件文件夹。

如果所有其他方法都失败了,请通过 WHM 或 CPanel 访问您的邮件服务器日志或联系您的托管服务提供商


$submit = $_POST['提交'];

您没有给<button name='submit'>一个值,if($submit){ POST 数据中该值是错误的/不存在的。


仍然不是空白页面的原因,需要查看您的apache/php错误日志或询问您的托管服务提供商。