Cannot add header informatiom?
| From: | Jan Grafström | Date: | Mon, 08 Oct 2001 06:04:32 +0000 |
| Subject: | Cannot add header informatiom? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-70319@lists.php.net to get a copy of this message | ||
Hi!
I have this form to logon to page3.php, but always get warning message
headers alredy sent.
What am I doing wrong?
Thanks for any help.
Jan
<?
session_start();
include($DOCUMENT_ROOT."/database.inc");
function form() {
echo "\n<form action=\"" . $PHP_SELF . "\" method=\"post\">";
echo "\n<P>Username";
echo "\n<br><INPUT NAME=\"user_name\" TYPE=\"text\" SIZE=\"20\"><br>";
echo "\n<P>Password";
echo "\n<br><INPUT NAME=\"password\" TYPE=\"password\" SIZE=\"20\"><br>";
echo "\n<input type=\"submit\" NAME=\"submit\" Value=\"Submit\">";
echo "\n</form>";
}
//Start page
echo "<html>\n<head>\n<title>Login example</title>\n</head>\n<body>";
form();
if ($user_name && $password) {
$res = @mysql_query("SELECT user_name FROM user WHERE user_name='$user_name' AND password='$password'");
if(@mysql_num_rows($res) != 0) {
$verified_user = $user_name;
session_register("$verified_user");
Header("Location: http://www.myserver.com/page3.php");
}} echo "\n</body>\n</html>"; ?> Jan Grafström Lillemans Hus AB Sweden