Glese Posted December 2, 2011 Share Posted December 2, 2011 I do know that nothing should be printed out before a header() redirect, yet this error message: Warning: Cannot modify header information - headers already sent by Is pointing to a meta tag, why does a meta tag become considered as a print out? The meta tags are as usually located in between the header tags of the whole website. What would you rather recommend in this case to accomplish a redirecting after a successful log in? Link to comment https://forums.phpfreaks.com/topic/252318-redirecting/ Share on other sites More sharing options...
KevinM1 Posted December 2, 2011 Share Posted December 2, 2011 It's still rendered by PHP. Remember: PHP is what is generating the HTML sent to the browser. Anything, even a blank space, that's rendered before you attempt to redirect will result in that error. The key is to organize your script(s) properly: ALL PHP processing (store results in variables and determine if you need to redirect) | | | | V HTML output Meshing chunks of PHP with HTML is a bad way to go. At most, you should only have if/else-conditionals and loops embedded in your HTML. All other processing should be done beforehand. Link to comment https://forums.phpfreaks.com/topic/252318-redirecting/#findComment-1293496 Share on other sites More sharing options...
ManiacDan Posted December 2, 2011 Share Posted December 2, 2011 You're confusing a file's header() (present on all files and not part of the content of the file) with the HTML <head> element (nothing to do with file headers, just some random part of the document). Link to comment https://forums.phpfreaks.com/topic/252318-redirecting/#findComment-1293508 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.