空PHP联系人表单=500错误

空PHP联系人表单=500错误,php,forms,twitter-bootstrap,email,Php,Forms,Twitter Bootstrap,Email,我以前做过很多联系方式,但由于某种原因,如果任何字段都是空的,那么我会被发送到错误500页,说 “500-内部服务器错误。 您正在查找的资源有问题,无法显示。“ 奇怪的是,表单仍然发送,无论输入了什么信息,提交功能和资产似乎都在工作 我尝试将变量设置为在表单之前和提交之后(添加“.$variablename”)都有一个值,这样它们就不是空的,但似乎不起作用。我使用带有说明的表单来填写每个字段,但它是用于web查询表单的,因此我希望客户能够添加他们想要的尽可能多或尽可能少的内容(例如,不需要表单验

我以前做过很多联系方式,但由于某种原因,如果任何字段都是空的,那么我会被发送到错误500页,说 “500-内部服务器错误。 您正在查找的资源有问题,无法显示。“

奇怪的是,表单仍然发送,无论输入了什么信息,提交功能和资产似乎都在工作

我尝试将变量设置为在表单之前和提交之后(添加“.$variablename”)都有一个值,这样它们就不是空的,但似乎不起作用。我使用带有说明的表单来填写每个字段,但它是用于web查询表单的,因此我希望客户能够添加他们想要的尽可能多或尽可能少的内容(例如,不需要表单验证)

我正在使用bootstrap作为网站的框架。 有什么想法吗??代码如下

HTML


错误500是一个内部服务器错误,因此您的php代码可能已关闭,修复这些错误的一个好方法是通过运行它的服务器上的错误日志。@MartinHenriksen但是。。。但是这意味着要查看错误日志文件!错误日志文件!啊!你想让人们真正了解他们的错误?那么猜谜几个小时的有趣游戏呢?我想你错过了
$msg
变量声明中的
。嘿,谢谢,我已经查看了错误日志,但似乎没有透露太多。请输入:
错误报告(E_ALL);ini_set('display_errors','on'))
首先是您的代码,并告诉我它给您带来了什么错误。
  <div class="modal fade" id="modalContact" role="dialog">

    <div class="modal-dialog">
        <div class="modal-content" id="form">

        <div class="modal-header">
            <h4>Not sure what you need?</h4><p>Fill in form below as you can and we will get in touch with some suggestions.  Please ensure you fill in every field, if you're not sure, say you're not sure!</p>

        </div>

        <div class="modal-body">

            <form action="scripts/contactscript.php" method="post" class="form-horizontal">
                <div class="form-group">
                    <label for="name" class="col-md-3 col-xs-12 col-lg-3 col-sm-3">Name: </label>
                    <div class="col-md-9 col-xs-12 col-lg-9 col-sm-9">
                        <input type="text" class="form-control" id="name"  name="name" placeholder="Please give us your full name">
                    </div>
                </div>

                <div class="form-group">
                    <label for="email" class="col-md-3 col-xs-12 col-lg-3 col-sm-3">Email: </label>
                    <div class="col-md-9 col-xs-12 col-lg-9 col-sm-9">
                        <input type="email" class="form-control" id="email" name="email" placeholder="Example@youremail.com">
                    </div>
                </div>

                <div class="form-group">
                    <label for="url" class="col-md-3 col-xs-12 col-lg-3 col-sm-3">Website:    <span class="glyphicon glyphicon-question-sign" data-toggle="tooltip" data-placement="right" title="If you already have a website please enter it here. Alternatively you may want to enter a link to a site that you like or feel would help us better understand your aims, this could be for content, styles or interactive sections.  Please let us know any specifics in the 'extra' section below"></span> </label>
                    <div class="col-md-9 col-xs-12 col-lg-9 col-sm-9">
                        <input type="text" class="form-control" id="url" name="url" placeholder="www.yourexample.com">
                    </div>

                </div>

                <div class="form-group">
                    <label for="background" class="col-md-3 col-xs-12 col-lg-3 col-sm-3">What: <span class="glyphicon glyphicon-question-sign" data-toggle="tooltip" data-placement="right" title="Let us know what you want from your website.  Is it a business, a blog, for fun? try and keep the description short using keywords"></span></label>
                    <div class="col-md-9 col-xs-12 col-lg-9 col-sm-9">
                        <textarea class="form-control" name="bkgrd" placeholder="Tell us about what you want to achieve" rows="3" id="background"></textarea>
                    </div>
                </div>

                <div class="form-group">
                    <label for="content" class="col-md-3 col-xs-12 col-lg-3 col-sm-3">Content: <span class="glyphicon glyphicon-question-sign" data-toggle="tooltip" data-placement="right" title="What tools do you need your website to have? "></span></label>
                    <div class="col-md-9 col-xs-12 col-lg-9 col-sm-9">
                        <label class="checkbox ">
                            <input type="checkbox" name="content[]" id="contact" value="contact form">Contact form
                        </label>
                        <label class="checkbox ">
                            <input type="checkbox" name="content[]" id="booking" value="booking system">Booking system/interactive calender
                        </label>
                        <label class="checkbox ">
                            <input type="checkbox" name="content[]" id="commerce" value="ecommerce"> E-commerce/secure check out
                        </label>
                        <label class="checkbox">
                            <input type="checkbox" name="content[]" id="cms" value="cms"> Content management system <span class="glyphicon glyphicon-question-sign" data-toggle="tooltip" data-placement="right" title="Having a content management system means users (or you) can update the website via a log on function, similar to a blog.  Without this you may need someone to update your website manually"></span>
                        </label>
                        <label class="checkbox">
                            <input type="checkbox" name="content[]" id="users" value="profiles"> Secure log in/user profiles
                        </label>
                        <label class="checkbox ">
                            <input type="checkbox" name="content[]" id="social" value="social"> Embedded social media
                        </label>
                        <label class="checkbox ">
                            <input type="checkbox" name="content[]" id="none" value="none"> None
                        </label>
                        <textarea class="form-control" rows="2" placeholder="Let us know any specific ideas you may have in mind or have discovered on other sites while browsing"></textarea>

                    </div>
                </div>

                <div class="form-group">
                    <label for="other" class="col-md-3 col-xs-12 col-lg-3 col-sm-3">Anything else? </label>
                    <div class="col-md-9 col-xs-12 col-lg-9 col-sm-9">
                        <textarea id="other" name="other" class="form-control" rows="2" placeholder="Anything else you feel might be useful" ></textarea>
                    </div>
                </div>

                <button type="submit" class="btn-default" name="submit" value="submit">Submit</button>
            </form>

        </div>


    </div>
    </div>

</div>
    if(isset($_POST['submit'])) {
    $to = "noreply@mywebsite.com";
    $subject = "Website Enquiry";
    $name = $_POST['name'];
    $email = $_POST['email'];
    $url = $_POST['url'];
    $bkgrd = $_POST['bkgrd'];
    $content = implode(": ", $_POST['content']);
    $other = $_POST['other'];


}

$sub2 = "Thank you for your enquiry";
$msg= "Thank you for your enquiry.  We have received your contact form and will be in touch soon to discuss this further\n


Thanks\n

;


$message = "From:  $name\n Email: $email\n URL: $url\n Overview: $bkgrd\n Content: $content \n Other: $other   ";

mail($email, $sub2, $msg);

if(mail($to, $subject, $message)){

    header("location: http://www.mywebsite.com");


}else{


    header("location: http://www.mywebsite.com");
}