rageshtly Posted August 19, 2008 Share Posted August 19, 2008 i want to use header function in my login page, means if login is correct page it is redirect from one page to other but while using header() i get this error messge Warning: Cannot modify header information - headers already sent .......... pls tell me how can i solve this problem Link to comment https://forums.phpfreaks.com/topic/120335-problem-while-using-header-function/ Share on other sites More sharing options...
trq Posted August 19, 2008 Share Posted August 19, 2008 Did you read the big HEADER ERROR sticky just above this thread? Link to comment https://forums.phpfreaks.com/topic/120335-problem-while-using-header-function/#findComment-619969 Share on other sites More sharing options...
PFMaBiSmAd Posted August 19, 2008 Share Posted August 19, 2008 And did you read the error message. It tells you where the output in your script is occurring that is preventing the header from being sent. Link to comment https://forums.phpfreaks.com/topic/120335-problem-while-using-header-function/#findComment-619970 Share on other sites More sharing options...
rageshtly Posted August 19, 2008 Author Share Posted August 19, 2008 sorry sir i cant get u Also i am new in this php language Link to comment https://forums.phpfreaks.com/topic/120335-problem-while-using-header-function/#findComment-619973 Share on other sites More sharing options...
MasterACE14 Posted August 19, 2008 Share Posted August 19, 2008 header(); needs to come before any output, such as HTML. wrong: <?php echo "<b>lol</b>"; if($something == $something_else) { header("Location: redirect.php"); } ?> right: <?php if($something == $something_else) { header("Location: redirect.php"); } else { echo "<b>lol</b>"; } ?> Link to comment https://forums.phpfreaks.com/topic/120335-problem-while-using-header-function/#findComment-619978 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.