Re: redirection...

From: Date: Thu, 13 Jul 2000 18:29:43 +0000
Subject: Re: redirection...
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-6522@lists.php.net to get a copy of this message
Put your PHP block before any of the HTML. -Rasmus On Thu, 13 Jul 2000, Subhrajyoti Moitra wrote: > 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@iitk.ac.in > > > >

« previous php.general (#6522) next »