dsy1971 2017-09-05 09:24
浏览 61

当我的php联系表单成功发送时,为什么我的页脚栏会消失?

  1. Hi. My footer bar disappears when I send a message successfully. How do I fix this problem? Please note: You must enter all the fields on the contact forms for the message to send successfully. I used php code for my contact form. My actual footer is in html code and is set to 100% width of the page.

Website link: Contact Me / php Form Page

Code displayed below:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html dir="ltr" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Contact Me | MXJGTV</title>
<link rel="shortcut icon" href="favicon.ico" >
<link rel="icon" type="image/gif" href="images/favicon.gif" >
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<meta content="Jack Griffiths' Motocross & Boxing website" name="keywords" />
<meta content="Jack Griffiths' Motocross & Boxing website" name="description" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<style>

html {
height: 100%;
width: 100%
}

a:link {
    color: purple;
}

a:visited {
    color: purple;
}


a:hover {
    color: purple;
}


a:active {
    color: purple;
}


    .auto-style5 {
    font-family: Arial, Helvetica, sans-serif;
    font-size: medium;
    color: #AAAAAA;
    text-align: left;
    max-width: 100%;
}
.auto-style8 {
    color: #AAAAAA;
}
    
#sitecontainer { 
width: 100% !important;
float:left !important;
min-width:600px !important;
max-width:2000px !important;
    }

#footer {
float: left !important;
width: 100% !important;
display: inline;
min-width:600px !important;
max-width:2000px !important;
position: relative !important;
clear: both !important; 
    }


#body {
position: relative !important;
text-align: center !important;
width:100% !important;
min-width:600px !important;
max-width:2000px !important;
}


#div {
width: 100%;
min-width:600px !important;
max-width:2000px !important;
}

a:active { outline: none; }.

}
.auto-style2 {
    font-family: Arial, Helvetica, sans-serif;
}
.auto-style8 {
    color: #000000;
}

.auto-style9 {
    color: #808080;
}
.auto-style10 {
    font-family: Arial, Helvetica, sans-serif;
}

.auto-style11 {
    text-decoration: none;
}
.auto-style12 {
    font-size: x-large;
    color: #00FF00;
}

.auto-style13 {
    font-family: Arial, Helvetica, sans-serif;
    color: #AAAAAA;
    text-align: center;
}

</style>


</head>
<body style="margin: 0; align: center; color: #000000; background-color: #000000; width: 100%;">
<body>

<div style="width: 100%; height: 58px;">
       
     
     <a href="Index.html">
     <img style=" float:left; display:inline" src="images3/MXJGTV.png" width="214" height="58" alt="MXJGTVLogo" />
     <a href="Photos.html">
     <img style=" float:left; display:inline"  src="images3/Photos.png" width="140" height="58" alt="Photos" />
     <a href="Videos.html">
     <img style=" float:left; display:inline"  src="images3/Videos.png" width="140" height="58" alt="Videos" /></a>
     <a href="Results.html">
     <img style=" float:left; display:inline" src="images3/Results.png" width="140" height="58" alt="Results" />
     <a href="form.php">
     <img style=" float:left; display:inline"  src="images3/Contact.png" width="140" height="58" alt="Contact" />
     <a href="Tumblr.html">
     <img style=" float:left; display:inline" src="images3/TumblrButton.png" width="140" height="58" alt="Tumblr" /></a>
     { img margin-right: 1006px; }

      </div>
    
    <img alt="border" height="1" src="images3/border.png" width="100%" />
    
    <center>
    <div id="page_content" class="auto-style5">
    <strong><br />

        <p>
        &nbsp;<span class="auto-style8"><br />
        </p>
        </span>
        <p class="auto-style13">
    <strong>Have A Question? Get In Touch</strong><br />
        </p>
        <p>
        <span class="auto-style8">
    <br />
        </p>
</p>
        </span><center>
        
<!-- EMAIL FORM CODING -->
<!-- EMAIL FORM CODING -->
<!-- EMAIL FORM CODING -->

        
        
<body>
<table width="450px">
</tr>
<tr>
 <td valign="top" class="auto-style11">
  <label for="first_name">
  <label for="comments">
    <strong><span class="auto-style12">* </span>
    </strong></label>First Name</label></td>
 <td valign="top">
  <input  type="text" name="first_name" maxlength="50" size="30"><span class="auto-style10">
  </span>
 </td>
</tr>
 
<tr>
 <td valign="top"" class="auto-style11">
  <label for="last_name">
  <label for="comments">
    <strong><span class="auto-style12">* </span>
    </strong></label>Last Name</label></td>
 <td valign="top">
  <input  type="text" name="last_name" maxlength="50" size="30"><span class="auto-style10">
  </span>
 </td>
</tr>
<tr>
 <td valign="top" class="auto-style11">
  <label for="email">
  <label for="comments">
    <strong><span class="auto-style12">* </span>
    </strong></label>Email Address</label></td>
 <td valign="top">
  <input  type="text" name="email" maxlength="80" size="30"><span class="auto-style10">
  </span>
 </td>
 
</tr>
<tr>
 <td valign="top" class="auto-style11">
  <label for="telephone">
  <label for="comments">
    <strong><span class="auto-style12">* </span>
    </strong></label>Telephone Number</label></td>
 <td valign="top">
  <input  type="text" name="telephone" maxlength="30" size="30"><span class="auto-style10">
  </span>
 </td>
</tr>
<tr>
 <td valign="top" class="auto-style11">
  <label for="comments">
    <strong><span class="auto-style12">* </span>
    </strong>Comments</label></td>
 <td valign="top">
  <textarea  name="comments" maxlength="1000" cols="35" rows="6" class="auto-style10"></textarea><span class="auto-style10">
  </span>
 </td>
 
</tr>
<tr>
 <td colspan="2" style="text-align:center">
</td>
</tr>
</table>
</form>
<br />
MXJGTV <a class="auto-style11" href="http://www.twitter.com/mxjgtv">Twitter</a> 
Page And MXJGTV <a class="auto-style11" href="http://www.Instagram.com/mxjgtv">
Instagram</a> Page<br />

</center>


                    
                    
                    
<!-- EMAIL FORM CODING -->
<!-- EMAIL FORM CODING -->
<!-- EMAIL FORM CODING -->

<body>
<p></p>
<div id="body">
<?php
if(isset($_POST['email'])) {
     
    // CHANGE THE TWO LINES BELOW
    $email_to = "jackgriffiths933@yahoo.com";
     
    $email_subject = "MXJGTV Contact Message";
     
     
    function died($error) {
        // your error code can go here
        
        echo "We are very sorry, but there were error(s) found with the form you submitted.";
        echo "These errors appear below.<br /><br />";
        echo $error."<br /><br />";
        echo "Please go back and fix these errors.<br /><br />";
        ?>
        </div>
         </center>
    </strong>
<br></br>
<br></br>
<br></br>
<br></br>
<br></br>
<br></br>
    <body>
<img src="images3/border.png" width="100%" height="1" alt="border" />
</body>
</head>

    <!--This is my footer below but it won't display when message is sent successfully-->
    <!--This is my footer below but it won't display when message is sent successfully-->
    <!--This is my footer below but it won't display when message is sent successfully-->
            
    <div id="footer">
    <div style="width: 100%; height: 58px;">
     <center>
      <img style=" float:left; display:inline" src="images3/MXJGTV.png" width="214" height="58" alt="MXJGTVLogo" />
      <a href="Allrightsreserved.html">
      <img style=" float:left; display:inline" src="images3/AllRights.png" width="366" height="58" alt="All Rights Reserved" /></a>
      <a href="PrivacyPolicy.Terms.html">
      <img style=" float:left; display:inline"  src="images3/Terms.png" width="162" height="58" alt="Terms" /></a>
      <a href="PrivacyPolicy.html">
      <img style=" float:left; display:inline" src="images3/Privacy.png" width="288" height="58" alt="Privacy" /></a>
      <span class="auto-style8">{ img margin-right: 890px; }
   </span>
    
    
    
</div>
<center>
<style="text-align:center;">

        <?php
        die();
    }
     
    // validation expected data exists
    if(!isset($_POST['first_name']) ||
        !isset($_POST['last_name']) ||
        !isset($_POST['email']) ||
        !isset($_POST['telephone']) ||
        !isset($_POST['comments'])) {
        died('We are sorry, but there appears to be a problem with the form you submitted.');      
    }
     
    $first_name = $_POST['first_name']; // required
    $last_name = $_POST['last_name']; // required
    $email_from = $_POST['email']; // required
    $telephone = $_POST['telephone']; // not required
    $comments = $_POST['comments']; // required
    
    
    $error_message = "";
    $string_exp = "/^[A-Za-z .'-]+$/";
  if(!preg_match($string_exp,$first_name)) {
    $error_message .= 'The First Name you entered does not appear to be valid.<br />';
  }
  if(!preg_match($string_exp,$last_name)) {
    $error_message .= 'The Last Name you entered does not appear to be valid.<br />';
  }
      $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
  if(!preg_match($email_exp,$email_from)) {
    $error_message .= 'The Email Address you entered does not appear to be valid.<br />';
  }
  if(strlen($comments) < 2) {
    $error_message .= 'The Comments you entered do not appear to be valid.<br />';
  }
  if(strlen($error_message) > 0) {
    died($error_message);
  }
    $email_message = "Form details below.

";
     
    function clean_string($string) {
      $bad = array("content-type","bcc:","to:","cc:","href");
      return str_replace($bad,"",$string);
    }
     
    $email_message .= "First Name: ".clean_string($first_name)."
";
    $email_message .= "Last Name: ".clean_string($last_name)."
";
    $email_message .= "Email: ".clean_string($email_from)."
";
    $email_message .= "Telephone: ".clean_string($telephone)."
";
    $email_message .= "Comments: ".clean_string($comments)."
";
     
     
// create email headers
$headers = 'From: '.$email_from."
".
'Reply-To: '.$email_from."
" .
'X-Mailer: PHP/' . phpversion();
@mail($email_to, $email_subject, $email_message, $headers); 
?>
</center>
<!-- place your own success html below -->
<p></p>
<center>
<span class="auto-style13">
<strong>
<style="text-align:center;">
<center>
<br class="auto-style13" />
<span class="auto-style13"><strong>Message sent successfully. I will be in touch with you very soon.</span></strong><span class="auto-style13">
</center>
<strong>
 
 </center>
    </strong>
        </strong>
        </span>
        <p><br />
        </span>
        </p>
    

   </center>
   </div>
   </div>
   
   </html>
   
   <?php
}
die();
?>

</div>
  • 写回答

2条回答 默认 最新

  • dongzhong9055 2017-09-05 09:29
    关注

    That is clear, because of the die(); line.

    评论

报告相同问题?

悬赏问题

  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?