Scott Taylor wrote:



I am simply trying to redirect users from one page to another. Yet when I use this code I get the following error:

*Warning*: Cannot add header information - headers already sent by (output started at /usr/local/psa/home/vhosts/miningstocks.com/httpdocs/etc/php/login/admin/test.php:8) in */usr/local/psa/home/vhosts/miningstocks.com/httpdocs/etc/php/login/admin/test.php* on line *9*
*
*


<html>
<head>
</head>

<body>

<?php
header('Location: http://www.slashdot.org/'); /* Redirect browser */

/* Make sure that code below does not get executed when we redirect. */
exit;
?>

You can't have any output before trying to use header(). <html>, etc, are considered output. So, the very first line in your file must be <?php and you can use header() before you echo anything within that PHP block.


--
---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals – www.phparch.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to