我正在使用一个带有bootstrap的PHP联系表单 . 它有“名字”“电子邮件”,“主题”和“信息” .

我不需要“主题”,所以我删除了它 . 但现在联系表格返回错误,上面写着“请输入留言” . 我还需要改变什么?我正在尝试使联系表单仅适用于“name”“email”和“Instagram @username” .

谢谢 .

<?php 
    $name = $_POST["name"];
    $email = $_POST["email"];
    $message = $_POST["message"];
    // Check input values for errors
    $errors = array();
    if(strlen($name) < 2) {
        if(!$name) {$errors[] = "Please enter your name!";}
        else {$errors[] = "Name requires at least 2 characters!";}
    }
    if(!$email) {$errors[] = "Please enter your email!";}
    else if(!validEmail($email)) {$errors[] = "Please enter a valid email!";}
    if(strlen($message) < 1) {
        if(!$message) {$errors[] = "Please enter your Instagram username!";}
        else{$errors[] = "Please enter your Instagram username!";}
    }
    // Output error message(s)
    if($errors) {
        $errortext = "";
        foreach($errors as $error) {
            $errortext .= "<li>".$error."</li>";
        }
        die("<ul class='errors arrowed'>". $errortext ."</ul><a href='index.html' class='btn'><i class='icon-left-1'></i> Back</a>");
    }

    // Send the email
    if($subject!=""){
        $subject = "Contact Form: $subject";
    }
    else {
        $subject = "Contact Form: $name";
    }
    $message = "$message";
    $headers = "From: ".$name." <".$email.">" . "\r\n" . "Reply-To: " . $email;
    mail($to, $subject, $message, $headers);
    // Output success message
    die("<p class='success'>Thank you! – Your message has been successfully sent!</p>");
    // Check if email is valid
    function validEmail($email) {
        $isValid = true;
        $atIndex = strrpos($email, "@");
        if (is_bool($atIndex) && !$atIndex) {
            $isValid = false;
        }
        else {
            $domain = substr($email, $atIndex+1);
            $local = substr($email, 0, $atIndex);
            $localLen = strlen($local);
            $domainLen = strlen($domain);
            if ($localLen < 1 || $localLen > 64) {
                // Local part length exceeded
                $isValid = false;
            }
            else if ($domainLen < 1 || $domainLen > 255) {
                // Domain part length exceeded
                $isValid = false;
            }
            else if ($local[0] == '.' || $local[$localLen-1] == '.') {
                // Local part starts or ends with '.'
                $isValid = false;
            }
            else if (preg_match('/\\.\\./', $local)) {
                // Local part has two consecutive dots
                $isValid = false;
            }
            else if (!preg_match('/^[A-Za-z0-9\\-\\.]+$/', $domain)) {
                // Character not valid in domain part
                $isValid = false;
            }
            else if (preg_match('/\\.\\./', $domain)) {
                // Domain part has two consecutive dots
                $isValid = false;
            }
            else if(!preg_match('/^(\\\\.|[A-Za-z0-9!#%&`_=\\/$\'*+?^{}|~.-])+$/',
            str_replace("\\\\","",$local))) {
                // Character not valid in local part unless local part is quoted
                if (!preg_match('/^"(\\\\"|[^"])+"$/',
                str_replace("\\\\","",$local))) {
                    $isValid = false;
                }
            }
            if ($isValid && !(checkdnsrr($domain,"MX") || checkdnsrr($domain,"A"))) {
                // Domain not found in DNS
                $isValid = false;
            }
        }
        return $isValid;
    }
?>
<section id="contact-form">
    <div class="container inner-top-xs inner-bottom">
        <div class="row">
            <div class="col-md-8 col-sm-9 center-block text-center">
                <header>
                    <h1>Awesome! Let's work together.</h1>
                    <p>Just fill out some information about yourself and we will get in touch within 24 hours.</p>
                </header>
            </div><!-- /.col -->
        </div><!-- /.row -->
        <div class="row">
            <div class="col-sm-12">
                <div class="row">
                    <div class="col-sm-6 outer-top-md inner-right-sm">
                        <h2>About</h2>
                        <form id="contactform" class="forms" action="contact.php" method="post">
                            <div class="row">
                                <div class="col-sm-6">
                                    <input type="text" name="name" class="form-control" placeholder="Name (Required)">
                                </div><!-- /.col -->
                            </div><!-- /.row -->
                            <div class="row">
                                <div class="col-sm-6">
                                    <input type="email" name="email" class="form-control" placeholder="Email (Required)">
                                </div><!-- /.col -->
                            </div><!-- /.row -->
                            <div class="row">
                                <div class="col-sm-6">
                                    <input type="text" name="subject" class="form-control" placeholder="Instagram @ (Required) ">
                                </div><!-- /.col -->
                            </div><!-- /.row -->
                            <button type="submit" class="btn btn-default btn-submit">Submit application</button>
                        </form>
                        <div id="response"></div>
                    </div><!-- ./col -->
                    <div class="col-sm-6 outer-top-md inner-left-sm border-left">
                        <h2>Are you a brand/business interested in our service?</h2>
                        <p>Great! Please click <a href="business.html">here</a> so we can provide you with an individually tailored application form.</p>
                        <h3>Influencer</h3>
                        <ul class="contacts">
                            <li><i class="icon-location contact"></i> 47 Boulcott street, Wellington, New Zealand</li>
                            <li><i class="icon-mobile contact"></i> +64 (021) 026 91 571</li>
                            <li><a href="mailto:info@reen.com"><i class="icon-mail-1 contact"></i> influencercrew@gmail.com</a></li>
                        </ul><!-- /.contacts -->
                        <div class="social-network">
                            <h3>Social</h3>
                            <ul class="social">
                                <li><a href="#"><i class="icon-s-facebook"></i></a></li>
                                <li><a href="#"><i class="icon-s-instagram"></i></a></li>
                            </ul><!-- /.social -->
                        </div><!-- /.social-network -->
                    </div><!-- /.col -->
                </div><!-- /.row -->
            </div><!-- /.col -->
        </div><!-- /.row -->
    </div><!-- /.container -->
</section>