levi2613 Posted March 13, 2009 Share Posted March 13, 2009 I've been banging my head against the wall for a few hours now, and I'm sure I'm overlooking something dumb.... I have a shift report form that has a .inc include at the top to redirect to a report_view if it has already been submitted: <?include 'schedule/admin/shift_report.inc';?> <?include 'employee/index/session.inc';?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <link rel="stylesheet" href="/new/style.css" type="text/css" charset="utf-8"> <link rel="stylesheet" href="/new/print.css" type="text/css" media="print"> <script type="text/javascript" src="/new/employee/index/session.js"></script> <title>Shift Report</title> </head> The code for the .inc file: ... if (mysql_num_rows($report_query)) { $report = mysql_fetch_assoc($report_query); if ($report['submitted']) { header("Location:schedule/admin/shift_report_view.php?date=$date"); exit; } } The report_view page has a similar setup: <?include 'schedule/admin/shift_report_view.inc';?> <?include 'employee/index/session.inc';?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <link rel="stylesheet" href="/new/style.css" type="text/css" charset="utf-8"> <link rel="stylesheet" href="/new/print.css" type="text/css" media="print"> <script type="text/javascript" src="/new/employee/index/session.js"></script> <title>Shift Report</title> </head> The session files log the user off after 30 minutes of inactivity. These files work on all my other pages, but just in case, I removed every instance of them in these files, and I still get the error.... I don't see any "echo"s or "print"s, but I'm still getting the ubiquitous: Warning: Cannot modify header information - headers already sent by (output started at /.../employee/index/session.inc:31) in /.../employee/schedule/admin/shift_report.inc on line 45 The session.inc file is only 30 lines long, and line 45 in shift_report.inc is the header call. *Any* help is much, much appreciated. Thanks, Levi Quote Link to comment https://forums.phpfreaks.com/topic/149285-solved-sessions-headers-and-warnings-oh-my/ Share on other sites More sharing options...
WolfRage Posted March 13, 2009 Share Posted March 13, 2009 If you have any space or new lines prior to the <?php tags it is considerd out put and thus your headers have been sent. Example Bad! <?php ?> Good <?php //code in here ?> Quote Link to comment https://forums.phpfreaks.com/topic/149285-solved-sessions-headers-and-warnings-oh-my/#findComment-783964 Share on other sites More sharing options...
levi2613 Posted March 13, 2009 Author Share Posted March 13, 2009 I tried pulling all the .inc code into the top of the files (including all the session.inc stuff), but still no joy. I'm working in PSPad, so I've never had any newline issues. The warning keeps citing the script include in the <head> section, but when I pull it out, I still get the same thing. Quote Link to comment https://forums.phpfreaks.com/topic/149285-solved-sessions-headers-and-warnings-oh-my/#findComment-783972 Share on other sites More sharing options...
Maq Posted March 13, 2009 Share Posted March 13, 2009 Have you gone through this sticky: HEADERS Quote Link to comment https://forums.phpfreaks.com/topic/149285-solved-sessions-headers-and-warnings-oh-my/#findComment-783974 Share on other sites More sharing options...
levi2613 Posted March 13, 2009 Author Share Posted March 13, 2009 Yes, actually I had, but thank you. I think I found the issue though -- I included the .inc file twice. Like I said, something totally dumb. Thanks so much for your time and some much-needed perspective. -L- Quote Link to comment https://forums.phpfreaks.com/topic/149285-solved-sessions-headers-and-warnings-oh-my/#findComment-783976 Share on other sites More sharing options...
Maq Posted March 13, 2009 Share Posted March 13, 2009 Like I said, something totally dumb. It always is... Gotta love it! Quote Link to comment https://forums.phpfreaks.com/topic/149285-solved-sessions-headers-and-warnings-oh-my/#findComment-784003 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.