Justtechjobs.com Find a programming school near you






Online Campus Both


php-general | 2000071

[PHP] redirection... From: Subhrajyoti Moitra (subhra <email protected>)
Date: 07/13/00

hi list,
have a look at the code below...

<?
session_start();
?>

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<?
global $linkid;
switch($linkid){
        case 1: header("location: http://www.yahoo.com");
                break;
        case 2: header("location: http://www.google.com");
                break;
}
?>

it gives me the error that:

Warning: Cannot add header information - headers already sent by (output
started at /home/subhra/public_html/php/al/test.php:2) in
/home/subhra/public_html/php/al/test.php on line 7

the error is pretty obvious ... since the header is already sent .. hence
resending another header generates this warning and the switch doesnot get
processed... how do i go about redirecting... under such circumstances...
am i missing something.. please help .. i am stuck ....

--------------------------------------------------------------------------------------
SECURITY IS A MYTH........!!!!!!!!
  "Linux for people with avg. IQ above 98"
--------------------------------------------------------------------------------------
 Subhrajyoti Moitra ------- C/212 Hall-I IIT-Kanpur India 208016
 email: subhra <email protected>
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe <email protected>
For additional commands, e-mail: php-general-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>