执行联系人表单后忽略PHP Include

执行联系人表单后忽略PHP Include,php,twitter-bootstrap,forms,contacts,Php,Twitter Bootstrap,Forms,Contacts,与Works的联系如预期,但当我被重定向到我的“谢谢”页面时。保存所有页脚内容的PHP include被省略。谁能看出我做错了什么 以下是有关表格: 当我提交时,电子邮件会按预期发送和接收,我会被重定向。但是页脚被省略了 <?php include ($_SERVER['DOCUMENT_ROOT'].'/content_includes/html_top.php'); ?> <!-- Main Body Container -->

与Works的联系如预期,但当我被重定向到我的“谢谢”页面时。保存所有页脚内容的PHP include被省略。谁能看出我做错了什么

以下是有关表格:

当我提交时,电子邮件会按预期发送和接收,我会被重定向。但是页脚被省略了

<?php 
include ($_SERVER['DOCUMENT_ROOT'].'/content_includes/html_top.php');
?>


        <!-- Main Body Container -->
        <div class="container-fluid contentBoxes bg-grey text-center">
            <div class="container">

<?php
if($_POST && isset($_FILES['my_file']))
{

    $from_email = $_POST['email']; //sender email
    $recipient_email = 'youname@example.com'; //recipient email
    $subject = 'Message from your website'; //subject of email
    $message = 'From: $name \n\nMessage:\n$message'; //message body

    $name = $_POST['name'];
    $email = $_POST['email'];
    $message = $_POST['message'];


    //get file details we need
    $file_tmp_name    = $_FILES['my_file']['tmp_name'];
    $file_name        = $_FILES['my_file']['name'];
    $file_size        = $_FILES['my_file']['size'];
    $file_type        = $_FILES['my_file']['type'];
    $file_error       = $_FILES['my_file']['error'];

    $user_email = filter_var($_POST["email"], FILTER_SANITIZE_EMAIL);

    if($file_error>0)
    {
        die('upload error');
    }
    //read from the uploaded file & base64_encode content for the mail
    $handle = fopen($file_tmp_name, "r");
    $content = fread($handle, $file_size);
    fclose($handle);
    $encoded_content = chunk_split(base64_encode($content));


        $boundary = md5("sanwebe"); 
        //header
        $headers = "MIME-Version: 1.0\r\n"; 
        $headers .= "From:".$from_email."\r\n"; 
        $headers .= "Reply-To: ".$user_email."" . "\r\n";
        $headers .= "Content-Type: multipart/mixed; boundary = $boundary\r\n\r\n"; 

        //plain text 
        $body = "--$boundary\r\n";
        $body .= "Content-Type: text/plain; charset=ISO-8859-1\r\n";
        $body .= "Content-Transfer-Encoding: base64\r\n\r\n"; 
        $body .= chunk_split(base64_encode($message)); 

        //attachment
        $body .= "--$boundary\r\n";
        $body .="Content-Type: $file_type; name=\"$file_name\"\r\n";
        $body .="Content-Disposition: attachment; filename=\"$file_name\"\r\n";
        $body .="Content-Transfer-Encoding: base64\r\n";
        $body .="X-Attachment-Id: ".rand(1000,99999)."\r\n\r\n"; 
        $body .= $encoded_content; 

    $sentMail = @mail($recipient_email, $subject, $body, $headers);
    if($sentMail) //output success or failure messages
    {       
        die("<h2>Thank You!</h2>
        <p>We will respond to you as soon as possible.</p>
        <p><a href='index.php' style='color:#ff0099;'>Click here to go back to our home page</a></p>");
    }else{
        die('Could not send mail! Please check your PHP mail configuration.');  
    }
}
?>

            </div>
        </div>

<?php 
include ($_SERVER['DOCUMENT_ROOT'].'/content_includes/html_bottom.php');
?>

这是因为所有代码路径都以
die()
结尾,这将停止脚本的执行。也许您想使用
echo
而不是
die()

:)谢谢。我知道事情会很简单。