Allan- Posted November 29, 2008 Share Posted November 29, 2008 If i have header('Location: http://localhost/'); on line 1-222 in my index.php file then it works correctly as it should be but if the same line of code is in the line 223 or after that, then header() function just dont do anything. I run my codes on my localhost server (Wampserver 2). Link to comment https://forums.phpfreaks.com/topic/134772-solved-header-not-working-correctly/ Share on other sites More sharing options...
ShiloVir Posted November 29, 2008 Share Posted November 29, 2008 http://www.phpfreaks.com/forums/index.php/topic,37442.0.html Theres a big stickie on this subject. Basicall header(); Must come before anything else. Link to comment https://forums.phpfreaks.com/topic/134772-solved-header-not-working-correctly/#findComment-701786 Share on other sites More sharing options...
Allan- Posted November 29, 2008 Author Share Posted November 29, 2008 But what should I use instead of header() function when I have to use it in the middle of the other code? Link to comment https://forums.phpfreaks.com/topic/134772-solved-header-not-working-correctly/#findComment-701788 Share on other sites More sharing options...
revraz Posted November 29, 2008 Share Posted November 29, 2008 You should display errors and enable error reporting. That way you can see where your Header error is. You can use javascript or HTML redirects instead. Link to comment https://forums.phpfreaks.com/topic/134772-solved-header-not-working-correctly/#findComment-701791 Share on other sites More sharing options...
Allan- Posted November 29, 2008 Author Share Posted November 29, 2008 Thanks, I'll use meta refresh now then. Link to comment https://forums.phpfreaks.com/topic/134772-solved-header-not-working-correctly/#findComment-701795 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.