dannyd Posted March 31, 2008 Share Posted March 31, 2008 I have a script that add/updates/deletes values in a database. After the sql takes place I'd like to redirect them to a page. When I do this I get the error below: Warning: Cannot modify header information - headers already sent by (output started at /admin/attributes.php:4) in... Is there a way to redirect without getting this error ? Link to comment https://forums.phpfreaks.com/topic/98887-header-error-on-redirect/ Share on other sites More sharing options...
metrostars Posted March 31, 2008 Share Posted March 31, 2008 It means that you have echoed some text to the page before you wanted to redirect. Make sure that you put the header before the headers of the page. Link to comment https://forums.phpfreaks.com/topic/98887-header-error-on-redirect/#findComment-505982 Share on other sites More sharing options...
dannyd Posted March 31, 2008 Author Share Posted March 31, 2008 The pages are really case statements. I'd like to redirect to the default case kind like below: header (location: attributes.php?action=default); Link to comment https://forums.phpfreaks.com/topic/98887-header-error-on-redirect/#findComment-506005 Share on other sites More sharing options...
xnowandtheworldx Posted March 31, 2008 Share Posted March 31, 2008 Yeah, if you have any html, or anything echoed before the actual header() function it won't work. So just make sure nothing is being outputted before hand. Link to comment https://forums.phpfreaks.com/topic/98887-header-error-on-redirect/#findComment-506010 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.