Kod
<?php
if (isset($_POST['submit'])) {
$message = NULL;
if (strlen($_POST['imie']) > 0) {
$imie = TRUE;
} else {
$imie = FALSE;
$message .= 'a gdzie imie?';
}
if ($imie) {
header ('Location: 006.php');
exit();
} else {
$message = 'wypełnij jeszcze raz!';
}
}
if (isset($message)) {
echo '<span style="color: #f00;">', $message, '</span>';
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title> example005 </title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<input type="text" name="imie" value="<?php if (isset($_POST['imie'])) echo $_POST['imie']; ?>" />
<input type="submit" name="submit" value="Wyślij" />
</form>
</body>
</html>
if (isset($_POST['submit'])) {
$message = NULL;
if (strlen($_POST['imie']) > 0) {
$imie = TRUE;
} else {
$imie = FALSE;
$message .= 'a gdzie imie?';
}
if ($imie) {
header ('Location: 006.php');
exit();
} else {
$message = 'wypełnij jeszcze raz!';
}
}
if (isset($message)) {
echo '<span style="color: #f00;">', $message, '</span>';
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title> example005 </title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<input type="text" name="imie" value="<?php if (isset($_POST['imie'])) echo $_POST['imie']; ?>" />
<input type="submit" name="submit" value="Wyślij" />
</form>
</body>
</html>
gdy formularza nie wypełnie, to pojawia mi sie prawidłowo informacja 'wypelnij jeszcze raz', ale gdy wypełnie to pojawia sie bład o tresci:
Warning: Cannot modify header information - headers already sent by (output started at c:\inetpub\wwwroot\examples\005.php:1) in c:\inetpub\wwwroot\examples\005.php on line 11
o co chodzi? bo plik 005.php istnieje, wiec nie mam pojecia...