网站未在FireFox或IE中打开/加载

时间:2017-02-21 15:27:39

标签: php html

这个网站是一个简单的5页网站,[1]在主页上有一个表单,并且已经重定向了“谢谢”#39;页。

它将在Chrome和Safari中打开并运行,但在Firefox和IE中无法使用。虽然它适用于"谢谢你"删除了html和PHP。

An .htaccess file has the contents:
*Options +FollowSymLinks
RewriteEngine On
Redirect 301 /index.html /index.php*

该代码源自W3C学校的示例。 有快速解决方法吗?

感谢您的评论。 w3c学校的链接是enter link description here除了引用之外,.htaccess文件中没有其他内容。我编辑的代码在这里:



<?php
if(isset($_POST["name"])) {

                $body = "Name : " . $_POST['name'] . "\n\rEmail : " . $_POST['email'] . "\n\rComment : " . $_POST['comment'] ;

                mail("j.leftwich@btinternet.com", "Form to email message", $body, "From: an@email.address"); 
}

?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="keywords" content="john leftwich, cool illustration, ideas, illustration, artwork, technical, cartoons, brackley, england, unique"/>
<meta name="description" content="Worked in the graphic arts field for ever and am happy to work free of charge for non profit-making and charitable organisations, and 'mates' of course"/>
<title>John Leftwich</title>
<link rel="stylesheet" type="text/css"
          href="https://fonts.googleapis.com/css?family=Rock Salt">
<link rel="stylesheet" type="text/css"
          href="https://fonts.googleapis.com/css?family=Roboto">
<link rel="stylesheet" type="text/css" href="styles.css" />
<script type="text/javascript" src="script.js">
</script>

</head>
<body>

<div id="newfont">John Leftwich</div>
<p></p>
<!--navbar-->
    <ul id="nav"> 
	<div id="anothernewfont">
	<li class="currentpage">HOME</li>
	<li><a href="sketching.html">SKETCH BOOK</a></li>
    <li><a href="technical.html">TECHNICAL</a></li>
    <li style="white-space:nowrap"><a href="life.html">LIFE DRAWING</a></li>
	<li><a href="#">COVERS</a></li>
	</div>
</ul>
    <!--</div><!--END navbar-->
<p> Click for larger images . . .</p>
<!--top page images-->
<div class="row">
  <div class="column">
    <img src="images/busart.jpg" style="width:100%" onclick="openModal();currentSlide(1)" class="hover-shadow cursor">
	<img src="images/reception1.jpg" style="width:100%" onclick="openModal();currentSlide(5)" class="hover-shadow cursor">
  </div>
  <div class="column">
    <img src="images/cartoon1.jpg" style="width:100%" onclick="openModal();currentSlide(2)" class="hover-shadow cursor">
	<img src="images/witney.jpg" style="width:100%" onclick="openModal();currentSlide(6)" class="hover-shadow cursor">
  </div>
  <div class="column">
    <img src="images/latojg.jpg" style="width:100%" onclick="openModal();currentSlide(3)" class="hover-shadow cursor">
	<img src="images/map1.jpg" style="width:100%" onclick="openModal();currentSlide(7)" class="hover-shadow cursor">
  </div>
  <div class="column">
    <img src="images/lockgates.jpg" style="width:100%" onclick="openModal();currentSlide(4)" class="hover-shadow cursor">
	<img src="images/cuttings.jpg" style="width:100%" onclick="openModal();currentSlide(8)" class="hover-shadow cursor">
  </div>
  
</div>
<!--END of top page images-->
<div id="textpara">
  <p style="line-height:1.4em">I have spent my working life in the graphic arts field and am happy to work free of charge for non profit-making and charitable organisations, and 'mates' of course! Please use the form below to contact me.</p>
  </div>
  
  <?php
// define variables and set to empty values
$nameErr = $emailErr = $genderErr = $websiteErr = "";
$name = $email = $gender = $comment = $website = "";

if ($_SERVER["REQUEST_METHOD"] == "POST") {
  if (empty($_POST["name"])) {
    $nameErr = "Name is required";
  } else {
    $name = test_input($_POST["name"]);
    // check if name only contains letters and whitespace
    if (!preg_match("/^[a-zA-Z ]*$/",$name)) {
      $nameErr = "Only letters and white space allowed"; 
    }
  }
  
  if (empty($_POST["email"])) {
    $emailErr = "Email is required";
  } else {
    $email = test_input($_POST["email"]);
    // check if e-mail address is well-formed
    if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
      $emailErr = "Invalid email format"; 
    }
  }

  if (empty($_POST["comment"])) {
    $comment = "";
  } else {
    $comment = test_input($_POST["comment"]);
  }
}

function test_input($data) {
  $data = trim($data);
  $data = stripslashes($data);
  $data = htmlspecialchars($data);
  return $data;
}

header("Location: {$_POST["redirect"]}");

?>
<!--START form-->
<div style="width:320px; margin:auto">
<form method="post" enctype="multipart/form-data" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">

<br>  
  <p>Name:<br>
  <input style="background-color:#f2f2f2" type="text" name="name" size="48" value="">
  </p>
  <p>Your email address here:<br>
  <input style="background-color:#f2f2f2" type="email" name="email" size="48" value="" >
  </p>
  <p>Comment:<br>
  <textarea style="background-color:#f2f2f2" name="comment" rows="5" cols="37"> </textarea>
  </p>
  <input type="submit" name="submit" value="Submit">
  <input type="reset" name="reset" value="Reset"></p>
  
  
 <!--extra bit added--> 
 <input type="hidden" name="redirect" value="http://www.johnleftwich.co.uk/thank_you_page.html">
<!--extra bit ends-->
 
</form>
</div>
<!--END form-->

<!--START footer-->
<div style="width:96%;margin-top:30px; border-bottom:1px solid #000099">
<div style="float:left"><p style="line-height:0em">Site host: <a class="text" href="http://www.selectinternet.co.uk">Select Internet</a><br></div>
<div style="float:right; text-align:right"><p style="line-height:0em">January 2017<br></div>
<div style="clear:both"></div>
</div>
<!--END footer-->
<!--START lightbox-->
<div id="myModal" class="modal">
  
  <div class="modal-content">
	<span class="close" onclick="closeModal()"><img src="images/button.png "/></span>
	
	<img class="next" onclick="plusSlides(1)" src="images/arrownext.png" />
	<img class="prev" onclick="plusSlides(-1)" src="images/arrowprev.png" />
	
    <div class="mySlides">
      <div class="numbertext">1 / 8</div>
      <img src="images/busart_wide.jpg" style="width:100%">
    </div>

    <div class="mySlides">
      <div class="numbertext">2 / 8</div>
      <img src="images/cartoon1_wide.jpg" style="width:100%">
    </div>

    <div class="mySlides">
      <div class="numbertext">3 / 8</div>
      <img src="images/latojg_wide.jpg" style="width:100%">
    </div>
    
    <div class="mySlides">
      <div class="numbertext">4 / 8</div>
      <img src="images/lockgates_wide.jpg" style="width:100%">
    </div>
	
	<div class="mySlides">
      <div class="numbertext">5 / 8</div>
      <img src="images/reception1_wide.jpg" style="width:100%">
    </div>
	
	<div class="mySlides">
      <div class="numbertext">6 / 8</div>
      <img src="images/witney_wide.jpg" style="width:100%">
    </div>
	
	<div class="mySlides">
      <div class="numbertext">7 / 8</div>
      <img src="images/map1_wide.jpg" style="width:100%">
    </div>
	
	<div class="mySlides">
      <div class="numbertext">8 / 8</div>
      <img src="images/cuttings_wide.jpg" style="width:100%">
    </div>
    
    <div class="caption-container">
      <p id="caption"></p>
    </div>


    <div class="columnlower">
      <img class="demo cursor" src="images/busart.jpg" style="width:100%" onclick="currentSlide(1)" alt="Disaster Management Course brochure illustration">
    </div>
    <div class="columnlower">
      <img class="demo cursor" src="images/cartoon1.jpg" style="width:100%" onclick="currentSlide(2)" alt="Bankers' &quot;loadsamoneyland&quot; and Dave Cameron">
    </div>
    <div class="columnlower">
      <img class="demo cursor" src="images/latojg.jpg" style="width:100%" onclick="currentSlide(3)" alt="Cover illustration for Land's End to J O'Groats Walk book">
    </div>
    <div class="columnlower">
      <img class="demo cursor" src="images/lockgates.jpg" style="width:100%" onclick="currentSlide(4)" alt="Canal lock gates sketch">
    </div>
	
	<div class="columnlower">
      <img class="demo cursor" src="images/reception1.jpg" style="width:100%" onclick="currentSlide(5)" alt="Business reception area">
    </div>
    <div class="columnlower">
      <img class="demo cursor" src="images/witney.jpg" style="width:100%" onclick="currentSlide(6)" alt="Witney tennis club logo">
    </div>
    <div class="columnlower">
      <img class="demo cursor" src="images/map1.jpg" style="width:100%" onclick="currentSlide(7)" alt="Map for Murder for thr Truth book">
    </div>
    <div class="columnlower">
      <img class="demo cursor" src="images/cuttings.jpg" style="width:100%" onclick="currentSlide(8)" alt="Newspaper cuttings">
    </div>
  </div>
</div>
  
</body>
</html>  
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:0)

因为有一个循环 我可以看到,当我想打开网站时,首先将我的连接路由到index.html 然后将我重定向到index.php但是在index.php这里也在index.php中再次重定向我 index.php或.htaccess文件中存在一些错误