TGWSE_GY Posted September 4, 2009 Share Posted September 4, 2009 Ok there is only one place in my script that I use headers, every time it reaches the header statement I get an error that the headers are already sent. <?php //This script will process the updates to the article that is designated by the sectionid passed from the previouse php page in the form. //Then we will take this and store it into the correct table of the database. Remember we always call our database configuration at the start. //Get database connectiong config include('phpcontent/config.php'); $id = $_POST['id']; $date = date(mdo); /************************************************************EDIT LINES STARTING HERE**************************************************/ $tblnews = "sndreview_news"; $tblreviews = "sndreview_reviews"; $tblfeatured = "sndreview_featured"; $tblindustry = "sndreview_industry"; /************************************************************STOP EDITING HERE ********************************************************/ //Get the entries from the form. $section = $_POST['section']; $new_title = addslashes($_POST['title']); $new_article = $_POST['article']; $summary = addslashes($_POST['summary']); $search = "src=\"http://www.soundreview.net/images/"; $replace = "src=\"images/"; $title = str_replace($search, $replace, $new_title); $article = str_replace($search, $replace, $new_article); $article = addslashes($article); switch ($section) { case 0: //News mysql_query("UPDATE `$tblnews` SET title='$title', article='$article', summary='$summary', date='$date' WHERE id='$id'") or die(mysql_error()); $sectionid = "news"; break; case 1: //Industry $tbl = $tblindustry; mysql_query("INSERT INTO `$tblindustry` ( title , article , summary , date ) VALUES ('$title', '$article', '$summary', '$date')") or die(mysql_error()); $sectionid = "radio"; break; case 2: //Reviews $tbl = $tblreviews; mysql_query("INSERT INTO `$tblreviews` ( title , article , summary , date ) VALUES ('$title', '$article', '$summary', '$date')") or die(mysql_error()); $sectionid = "reviews"; break; case 3: //Featured $tbl = $tblfeatured; mysql_query("INSERT INTO `$tblfeatured` ( featured , date ) VALUES ('$article', '$date')") or die(mysql_error()); $sectionid = "featured"; break; case 4: $tbl = "sndreview_photos"; mysql_query("INSERT INTO `$tbl` ( article , date ) VALUE ('$article', '$date')") or die(mysql_error()); break; } header("Location: http://www.soundreview.net/admin/classes/forms/maineditor.php?section=$sectionid"); ?> Is there anyway to test if the header has already been sent and the clear it and send the new one? This same exact code works on several other domains without fail. And YES I AM SURE! that the headers are not being sent anywhere else in my script. Thanks Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted September 4, 2009 Share Posted September 4, 2009 If you post the error message, someone could directly help you with the problem. The error message states where the output is occurring at that is preventing the headers from working. Quote Link to comment Share on other sites More sharing options...
TGWSE_GY Posted September 4, 2009 Author Share Posted September 4, 2009 Warning: Cannot modify header information - headers already sent by (output started at /home/.valerieheater/jcnh74/soundreview.net/admin/classes/forms/process_changes.php:1) in /home/.valerieheater/jcnh74/soundreview.net/admin/classes/forms/process_changes.php on line 60 Quote Link to comment Share on other sites More sharing options...
Mark Baker Posted September 4, 2009 Share Posted September 4, 2009 Output is being sent in line 1 of process_changes.php already sent by (output started at /home/.valerieheater/jcnh74/soundreview.net/admin/classes/forms/process_changes.php:1) Eithe ryou have a space or some html before your opening <?php or the file has been saved with a BOM marker Quote Link to comment Share on other sites More sharing options...
TGWSE_GY Posted September 4, 2009 Author Share Posted September 4, 2009 HAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHHAHA there was a space before my <?php tag. Thanks Quote Link to comment Share on other sites More sharing options...
eugeniu Posted September 4, 2009 Share Posted September 4, 2009 Hehe. I never would have thought of that if I were you . Quote Link to comment 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.