無法修改頭文件信息 - 在C:\ xampp \ htdocs \中已經發送頭文件(輸出在C:\ xampp \ htdocs \ d \ login.php中爲15)第41行的d \ login.php
我在登錄表單時遇到此錯誤第41行的問題是什麼?無法修改頭信息 - 已發送的頭文件
<!doctype html>
<html>
<head>
<title>Login</title>
</head>
<body>
<p><a href="register.php">Register</a> | <a href="login.php">Login</a></p>
<h3>Login Form</h3>
<form action="" method="POST">
Username: <input type="text" name="user"><br />
Password: <input type="password" name="pass"><br /> \t
<input type="submit" value="Login" name="submit" />
</form>
<?php
if(isset($_POST["submit"])){
if(!empty($_POST['user']) && !empty($_POST['pass'])) {
$user=$_POST['user'];
$pass=$_POST['pass'];
$con=mysql_connect('localhost','yoyo','glappyhunt') or die(mysql_error());
mysql_select_db('user_registration') or die("cannot select DB");
$query=mysql_query("SELECT * FROM login WHERE username='".$user."' AND password='".$pass."'");
$numrows=mysql_num_rows($query);
if($numrows!=0) {
while($row=mysql_fetch_assoc($query)) {
$dbusername=$row['username'];
$dbpassword=$row['password'];
}
if($user == $dbusername && $pass == $dbpassword0 {
(ob_start());
$_SESSION['sess_user']=$user;
/* Redirect browser */
header("Location: member.php");
}
} else {
echo "Invalid username or password!";
}
} else {
echo "All fields are required!";
}
}
?>
</body>
</html>
可能重複的[如何修復]標題已發送「PHP錯誤」(http://stackoverflow.com/questions/8028957/how-to-fix-headers-already-sent-error-in-php) – Rizier123 2015-03-02 09:27:19