contraboybish Posted May 13, 2007 Share Posted May 13, 2007 This has to be one of the most annoying errors ever!!!!! I have the following code..... <?php require_once('testconnection.php'); $query = "DELETE FROM subscription WHERE subId = {$_POST['id']}"; odbc_exec($odbc, $query) or die (odbc_errormsg()); odbc_close($odbc); header("Location: register_results.php"); ?> The above deletes a reat but i get the follwing error..... Warning: Cannot modify header information - headers already sent by (output started at d:\inetpub\logisticsbusiness.com\web\content\library\testconnection.php:2) in d:\inetpub\logisticsbusiness.com\web\content\library\register_delete.php on line 10 Any thoughts anyone :-) Bish Quote Link to comment https://forums.phpfreaks.com/topic/51175-solved-header-function-wont-redirect/ Share on other sites More sharing options...
paul2463 Posted May 13, 2007 Share Posted May 13, 2007 headers wont work if there is anything output to screen before they happen, it is saying that an output occured on line 2 in testconnection.php if there is no output there try removing all white space from above the opening <?php tag if there is any Quote Link to comment https://forums.phpfreaks.com/topic/51175-solved-header-function-wont-redirect/#findComment-251949 Share on other sites More sharing options...
contraboybish Posted May 13, 2007 Author Share Posted May 13, 2007 Ive tried removing white spaces still get the same error. Is there another way of redirecting instead of using Header? Bish Quote Link to comment https://forums.phpfreaks.com/topic/51175-solved-header-function-wont-redirect/#findComment-251953 Share on other sites More sharing options...
clown[NOR] Posted May 13, 2007 Share Posted May 13, 2007 dunno if it would work, but maybe if you replace header() with <meta http-equiv="refresh" content="0;YOUR-URL-HERE" /> but keep in mind... not everyone support this code... Quote Link to comment https://forums.phpfreaks.com/topic/51175-solved-header-function-wont-redirect/#findComment-251956 Share on other sites More sharing options...
contraboybish Posted May 13, 2007 Author Share Posted May 13, 2007 Tried this as below..... <?php require_once('testconnection.php'); $query = "DELETE FROM subscription WHERE subId = {$_POST['id']}"; odbc_exec($odbc, $query) or die (odbc_errormsg()); odbc_close($odbc); #header("Location: recorddeleted.php"); <meta http-equiv="refresh" content="0;www.logisticsbusiness.com/library/recorddeleted.php" /> ?> I get the following error........ Parse error: parse error, unexpected '<' in d:\inetpub\logisticsbusiness.com\web\content\library\register_delete.php on line 7 I can't believe how difficult it is to redirect!!! BIsh Quote Link to comment https://forums.phpfreaks.com/topic/51175-solved-header-function-wont-redirect/#findComment-251962 Share on other sites More sharing options...
esukf Posted May 13, 2007 Share Posted May 13, 2007 <?php // <meta> tag is html, you need to echo it! echo '<meta http-equiv="refresh" content="0;www.logisticsbusiness.com/library/recorddeleted.php" />'; ?> If you post your testconnection.php script, we can then see where the header already sent problem is. Quote Link to comment https://forums.phpfreaks.com/topic/51175-solved-header-function-wont-redirect/#findComment-251972 Share on other sites More sharing options...
contraboybish Posted May 13, 2007 Author Share Posted May 13, 2007 Ive solved it, there was a blank line in my testconnection.php before the <?php start tag!!! What a numpty. Many thanks guys :-) Bish Quote Link to comment https://forums.phpfreaks.com/topic/51175-solved-header-function-wont-redirect/#findComment-251978 Share on other sites More sharing options...
paul2463 Posted May 13, 2007 Share Posted May 13, 2007 Ive tried removing white spaces still get the same error. Bish didnt try hard enough then??? LOL blank lines are whitespace try removing all white space from above the opening <?php tag if there is any ring any bells??? Quote Link to comment https://forums.phpfreaks.com/topic/51175-solved-header-function-wont-redirect/#findComment-251983 Share on other sites More sharing options...
contraboybish Posted May 13, 2007 Author Share Posted May 13, 2007 its always the obviuos eh :-/ As i said, what a numpty. Many Thanks Bish Quote Link to comment https://forums.phpfreaks.com/topic/51175-solved-header-function-wont-redirect/#findComment-251986 Share on other sites More sharing options...
paul2463 Posted May 13, 2007 Share Posted May 13, 2007 if its working can you close this topic by clicking the SOLVED button? We all make mistakes, spotting them is an art form which many of cant see in our own code, take heart - more practice less mistakes, but by hell they get harder to find Quote Link to comment https://forums.phpfreaks.com/topic/51175-solved-header-function-wont-redirect/#findComment-251988 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.