2015-01-07 62 views
0

我已經遇到一個問題..不能修改標題信息 - 標題已經發出已

它輸出的錯誤:無法修改標題信息..

,會是什麼原因?我怎麼能修復它.. 感謝您的幫助..我檢查了所有,但仍然無法修復它。會有什麼問題?

這裏是我下面的代碼:

<!DOCTYPE html> 
<html dir="ltr" lang="en-US"><head><!-- Created by Artisteer v4.3.0.60747 --> 
    <meta charset="utf-8"> 
    <title>Home</title> 
    <meta name="viewport" content="initial-scale = 1.0, maximum-scale = 1.0, user-scalable = no, width = device-width"> 

    <link rel="stylesheet" href="style.css" media="screen"> 
    <link rel="stylesheet" href="style.responsive.css" media="all"> 
<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Salsa|PT+Sans&amp;subset=latin"> 

    <script src="jquery.js"></script> 
    <script src="script.js"></script> 
    <script src="script.responsive.js"></script> 


<script>jQuery(function ($) { 
    'use strict'; 
    if ($.fn.themeSlider) { 
     $(".art-slidecontainera65d557e889141cb8638b82feda1c335").each(function() { 
      var slideContainer = $(this), tmp; 
      var inner = $(".art-slider-inner", slideContainer); 
      inner.children().filter("script").remove(); 
      var helper = null; 

      if ($.support.themeTransition) { 
       helper = new BackgroundHelper(); 
       helper.init("fade", "next", $(".art-slide-item", inner).first().css($.support.themeTransition.prefix + "transition-duration")); 
       inner.children().each(function() { 
        helper.processSlide($(this)); 
       }); 


      } else if (browser.ie && browser.version <= 8) { 
       var slidesInfo = { 
".art-slidea65d557e889141cb8638b82feda1c3350": { 
    "bgimage" : "url('images/slidea65d557e889141cb8638b82feda1c3350.jpg')", 
    "bgposition": "0 0", 
    "images": "", 
    "positions": "" 
}, 
".art-slidea65d557e889141cb8638b82feda1c3351": { 
    "bgimage" : "url('images/slidea65d557e889141cb8638b82feda1c3351.jpg')", 
    "bgposition": "0 0", 
    "images": "", 
    "positions": "" 
} 
       }; 
       $.each(slidesInfo, function(selector, info) { 
        processElementMultiplyBg(slideContainer.find(selector), info); 
       }); 
      } 

      inner.children().eq(0).addClass("active"); 
      slideContainer.themeSlider({ 
       pause: 2600, 
       speed: 600, 
       repeat: true, 
       animation: "fade", 
       direction: "next", 
       navigator: slideContainer.siblings(".art-slidenavigatora65d557e889141cb8638b82feda1c335"), 
       helper: helper 
      }); 


     }); 
    } 
}); 
</script></head> 
<body> 
<div id="art-main"> 
<header class="art-header"> 

    <div class="art-shapes"> 

      </div> 

<h1 class="art-headline"> 
    <a href="index.php">FPES</a> 
</h1> 
<h2 class="art-slogan">Faculty Performance Evaluation System.</h2> 

<?php 
//connect to the database 
$connect = mysql_connect("localhost","root",""); 
mysql_select_db("db_fpes",$connect); //select the table 

if(isset($_POST['btn_submit'])){ 
    $username = $_POST['username']; 
    $password = $_POST['pass']; 
    $result = mysql_query ("SELECT * FROM professors where fac_stat = 1 and Faculty_code = '".$username."' and Faculty_code = '".$password."' "); 
    if($username == 'admin' && $password == 'admin' && mysql_num_rows($result) == 0){ 
       header('Location: admin/home.php'); die; 
    } 
    else 
    { 
      $row = mysql_fetch_assoc($result); 
      if($row['system_user'] == 1){ 
       header('Location: Grading/index.php'); die; 
      } 
      else if($row['system_user'] == 2){ 
       header('Location: Secretary/home.php'); die; 
      } 
      else 
       header('Location: index.php'); die; 
    } 
} 
?> 
<nav class="art-nav"> 
    <ul class="art-hmenu"><li><a href="home.html" class="active">Home</a></li> 
    <li><a href="add-profile.html">About Us</a></li> 

</ul> 
</nav> 
</header> 
<div class="art-sheet clearfix"> 
      <div class="art-layout-wrapper"> 
       <div class="art-content-layout"> 
        <div class="art-content-layout-row"> 
         <div class="art-layout-cell art-content"><article class="art-post art-article">       
       <div class="art-postcontent art-postcontent-0 clearfix"><div class="art-content-layout-wrapper layout-item-0"> 
<div class="art-content-layout layout-item-1"> 
    <div class="art-content-layout-row"> 
    <div class="art-layout-cell layout-item-2" style="width: 100%" > 
     <p></p><div id="a65d557e889141cb8638b82feda1c335" style="position: relative; display: inline-block; z-index: 0; margin: 0px; border-width: 0px; " class="art-collage"> 
<div class="art-slider art-slidecontainera65d557e889141cb8638b82feda1c335" data-width="900" data-height="287"> 
    <div class="art-slider-inner"> 
<div class="art-slide-item art-slidea65d557e889141cb8638b82feda1c3350" > 


</div> 
<div class="art-slide-item art-slidea65d557e889141cb8638b82feda1c3351" > 


</div> 

    </div> 
</div> 
<div class="art-slidenavigator art-slidenavigatora65d557e889141cb8638b82feda1c335" data-left="1" data-top="1"> 
<a href="#" class="art-slidenavigatoritem"></a><a href="#" class="art-slidenavigatoritem"></a> 
</div> 



    </div> 


     <p> 
     </p><p> 
     </p> 
    </div> 
    </div> 
</div> 
</div> 
<div class="art-content-layout layout-item-1"> 
    <div class="art-content-layout-row"> 
    <div class="art-layout-cell layout-item-3" style="width: 67%" > 
     <h2><span style="color: rgb(128, 0, 0); line-height: 51px; font-size: 40px;">Welcome&nbsp</span><span style="color: rgb(108, 127, 147); line-height: 31px; font-size: 28px;">to our site!</span></h2> 
     <h3><img width="250" height="195" alt="" src="images/1037312_small500.jpg" style="float: left; margin-right: 15px;" class="">Performance Faculty Evalutaion System.&nbsp;</h3> 
     <p>Insert Description Here!.<br></p> 
    </div> 

    <div class="art-layout-cell layout-item-4" style="width: 33%" > 
    <form method = "post" action = ""> 
     <h1>Please Login<br></h1><p style="margin-top: 10px;"> Username: <input type="text" name = "username" >&nbsp;</p><p> 
     <p> Password: <input type="text" name = "pass"></p><p style="text-align: right;">&nbsp; 
     <input type = "submit" name = "btn_submit" class="art-button" value = "Login"/><br></p> 
    </form> 
    </div> 
    </div> 
</div> 



</article></div> 
        </div> 
       </div> 
      </div> 
    </div> 
<footer class="art-footer"> 
    <div class="art-footer-inner"> 
<p>GoMiracles © 2014 - 2015. All Rights Reserved.<br></p> 
    </div> 
</footer> 

</div> 


</body></html> 
+5

的可能重複[如何解決「頭已經發送」錯誤在PHP中](http://stackoverflow.com/questions/8028957/how-to-fix-headers-already-sent-error-in-php) –

+0

如果這是所有的代碼,然後確保你的文件不是**編碼爲帶有BOM的UTF-8。 BOM(字節順序標記)是編輯器在文件的最開始處(<?php'之前)插入的(不可見的)字符序列,對於UTF-8編碼來說,它是完全沒有用的。 – axiac

+1

等待我將使用我的所有代碼進行編輯.. –

回答

1

Headers already sent是你嘗試將用戶重定向與header()或一個問題,當你試圖啓動一個會話session_start()當瀏覽器已經呈現的內容(例如HTML,但也可以是例如PHP回聲語句)。

要解決此問題,請在發送標題之前檢查是否有任何echo()語句或原始HTML,並檢查在<?php之前是否沒有空格。

更詳細的解答,幫助您解決這個問題可以在這裏找到:https://stackoverflow.com/a/8028987/4274852

我懷疑你沒有爲我們提供所有的代碼,因爲我無法找到的那一刻你的任何具體問題。我希望上面的鏈接可以幫助你調試你的代碼,如果沒有的話:確保在PHP代碼上面發佈一切。

只是說明:我看到您仍在使用mysql_query語句,這些語句已被棄用。改爲使用msqliPDO

編輯

我看到你發佈你的代碼,請嘗試更換所有的PHP代碼在你的頁面,而不是在中間的頂部,它應該工作。在您當前的代碼中,您在PHP代碼(本例中爲<h1><p>元素)之前具有原始HTML,這使得無法使用header()發送更多頭數據,因爲所有頭文件在呈現頁面之前已經發送。

我editted你的代碼,希望能夠解決這個問題,你可以在這裏找到它(而不是在這裏張貼,這將使一個尷尬的長期答案):

http://pastebin.com/0JfBdjU5

+0

先生可以將我的編輯代碼發送給我的電子郵件,因爲我的連接速度太慢,無法提供。謝謝。這是我的電子郵件。 [email protected]謝謝.. :) –

+1

非常感謝先生。 –

相關問題