Това ми е кода и ми показва следната грешка :
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\index.php:1) in C:\xampp\htdocs\index.php on line 2
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\index.php:1) in C:\xampp\htdocs\index.php on line 2
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\index.php:1) in C:\xampp\htdocs\index.php on line 2
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\index.php:1) in C:\xampp\htdocs\index.php on line 2
Код:
<?php
session_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title> Test </title>
</head>
<body>
<?
if(isset($_SESSION['is_logged']) && $_SESSION['is_logged'] === true) {
echo '<a href=add.php>Add</a> | <a href=logout.php>Logout</a>';
}else {
if(isset($_GET['error']) && $_GET['error']==1){ echo 'Error!'; }
?>
<form method="post" action="login.php">
<p>Useraname</p><input type="text" name="login" /><br>
<p>Pass</p><input type="password" name="pass" /><br><br>
<input type="submit" value="login" /><br>
</form>
<?
}
?>
</body>
</html>