Thanks Matthew
| From: | Jan Grafström | Date: | Mon, 08 Oct 2001 14:15:42 +0000 |
| Subject: | Thanks Matthew | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-70362@lists.php.net to get a copy of this message | ||
I just moved my if statement to next under my include.
Jan
Matthew Loff wrote:
The word "Header" is self-explanatory :) You cannot send a "Header" (comes -before- HTML) after your script has sent HTML to the browser. You have two options-- Rearrange your code so the header is sent, if necessary, -before- any HTML output... Or, you can use output buffering functions. (see ob_start() and flush() in the manual) -----Original Message----- From: Jan Grafström [mailto:jan@grafstrom.net] Sent: Monday, October 08, 2001 2:05 AM To: php-general@lists.php.net Subject: [PHP] Cannot add header informatiom? 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