FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Header redirect problem





[FuN]goku
right i got this code
Code:

if($forward == "1")
$redirect = header("Refresh: 2; URL=/xxx/");
}else{
$redirect = header("Refresh: 2; URL=/xxx/add.php");
}

and when i use header in an if statement it gives me this error.
Quote:

Warning: Cannot modify header information - headers already sent by (output started at /home/xxx/public_html/xxx/action.php:45) in /home/xxx/public_html/xxx/action.php on line 54


Any ideas why?

EDIT: it lets me put it at the top of the code, just not at the bottom,

EDIT2: Nevermind i just used the html redirect. (finally tried it after half hour : / )
ncwdavid
you cant have any output on the screen like html before the header function.
chris20
as ncwdavid said, you need to have the header function before anything you output or it will not work

you can use the meta refresh tag thing though, here is a link to how to use it..
http://webdesign.about.com/od/metataglibraries/a/aa080300a.htm

you mentioned in your post that you used the html redirect instead, im not sure if that means this or not, so i thought i might as well post it if anyone else needs a solution to this problem
JayBee
I wrote some sugestions few months before
Arrow http://www.frihost.com/forums/vt-55648.html#463905
Related topics
Header("Location: PROBLEM");
Google and Domains: help
phpBB header problem.
Header phase problem
Get country where server stands.
SquirrelMail problem
Session variables versus page variables
Win A Domain ..... The Best FriHost Website Edition
PHP and cookies. Simple problem.
SPLIT long task?
Having Trouble With Drop Down Menus
How to automate 3rd party forms and upload data?
Question regarding phpnuke and phpbb3 in ftp
Help with PHP contact form
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.