redirecting header

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
rambabu
Forum Newbie
Posts: 1
Joined: Fri Jun 16, 2006 1:15 pm

redirecting header

Post by rambabu »

can anyone help me out...

i have a login page...in php and i am doing the validations...but unable to redirect to my homepage...

header("Location:http://www.searchyd.com/index.php");

warning message:Cannot modify header information - headers already sent by (output started at /var/www/vhosts/searchyd.com/httpdocs/user/db.php:2)
User avatar
ambivalent
Forum Contributor
Posts: 173
Joined: Thu Apr 14, 2005 8:58 pm
Location: Toronto, ON

Post by ambivalent »

User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Re: redirecting header

Post by RobertGonzalez »

rambabu wrote:can anyone help me out...

i have a login page...in php and i am doing the validations...but unable to redirect to my homepage...

header("Location:http://www.searchyd.com/index.php");

warning message:Cannot modify header information - headers already sent by (output started at /var/www/vhosts/searchyd.com/httpdocs/user/db.php:2)
Just as an FYI, this error has been posted in this community like ten times in the last two weeks. Did you search first before posting? I am not trying to be rude, just trying to keep you coming back.

The error you are getting is because you are sending output to the browser at some point prior to your posted call to header(). Once anything has been sent to the browser you will get that error when using header().
Post Reply