Re: header - error all headers have been sent.
| From: | Andy Hoffman | Date: | Wed, 11 Oct 2000 15:50:12 +0000 |
| Subject: | Re: header - error all headers have been sent. | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-3162@lists.php.net to get a copy of this message | ||
Flint Doungchak wrote:
> Check to make sure that you don't output any HTML before your header
> command. This includes any spaces that may be echoed or what not. The header
> must be the first thing to occur.
do something like this AT THE TOP of the php script that processes the form...
<?php
# do some stuff with the form variables
$myDummy = $HTTP_POST_VARS['formVariableName'];
# database code, yada yada
$sqlstmt = "INSERT INTO tablename (myFieldName) VALUES ($myDummy)";
# do your database update, etc.
# call the header funtion
header("Location: redirectedurl.php\n\n");
?>
As Flint stated, there should be NOTHING before the header function which would
output any kind of text to the browser :)
--
Andy Hoffman
Web Developer
Bristol-Myers Squibb
email: andy.hoffman@bms.com